diff --git a/src/main/java/me/nickp0is0n/easylocalize/utils/LocalizeParser.java b/src/main/java/me/nickp0is0n/easylocalize/utils/LocalizeParser.java index 9ff01b6..25866f8 100644 --- a/src/main/java/me/nickp0is0n/easylocalize/utils/LocalizeParser.java +++ b/src/main/java/me/nickp0is0n/easylocalize/utils/LocalizeParser.java @@ -15,7 +15,6 @@ public class LocalizeParser { private String currentString = null; private boolean multilineCommentMode = false; private String currentMark = null; - private String header = null; private final ArrayList strings = new ArrayList<>(); diff --git a/src/main/kotlin/me/nickp0is0n/easylocalize/models/LocalizedString.kt b/src/main/kotlin/me/nickp0is0n/easylocalize/models/LocalizedString.kt index dc37f7f..5eafb1e 100644 --- a/src/main/kotlin/me/nickp0is0n/easylocalize/models/LocalizedString.kt +++ b/src/main/kotlin/me/nickp0is0n/easylocalize/models/LocalizedString.kt @@ -20,10 +20,12 @@ data class LocalizedString @JvmOverloads constructor( } else { val commentStrings = listOf(*comment.split("\n").toTypedArray()) commentStrings.forEach { - rawLocalizedStringBuilder - .append("//") - .append(it) - .append("\n") + if(it.isNotEmpty()) { + rawLocalizedStringBuilder + .append("//") + .append(it) + .append("\n") + } } } } diff --git a/src/main/kotlin/me/nickp0is0n/easylocalize/utils/LocalizeExporter.kt b/src/main/kotlin/me/nickp0is0n/easylocalize/utils/LocalizeExporter.kt index 819942d..0fd6228 100644 --- a/src/main/kotlin/me/nickp0is0n/easylocalize/utils/LocalizeExporter.kt +++ b/src/main/kotlin/me/nickp0is0n/easylocalize/utils/LocalizeExporter.kt @@ -9,17 +9,19 @@ class LocalizeExporter { val writer = PrintWriter(outputFile) var lastMark: String? = null var isFirstString = true + var isHeader = false writer.use { localizedStrings.forEach { if (isFirstString && it.isCommentMultilined) { writer.println("/*${it.comment}*/") // writing xcode copyright header on top + isHeader = true } if (it.mark != lastMark && it.mark != null) { lastMark = it.mark writer.println("\n// MARK:${it.mark}\n") } - if (isFirstString) { + if (isFirstString && isHeader) { writer.println(it.toStringWithoutComment()) isFirstString = false } diff --git a/src/test/resources/exporter/withMultilineComment b/src/test/resources/exporter/withMultilineComment index 0c09490..82f5dbf 100644 --- a/src/test/resources/exporter/withMultilineComment +++ b/src/test/resources/exporter/withMultilineComment @@ -1,5 +1,3 @@ -/* -Sample -comment -*/ +/*Sample +comment*/ "CONTINUE-ERASE" = "Continue and Erase";