Skip to content

Commit

Permalink
Merge pull request #70 from crowdin/new_release_2.0.21
Browse files Browse the repository at this point in the history
New release 2.0.21
  • Loading branch information
dmtr-p authored Dec 14, 2017
2 parents 79ed769 + e66e03c commit 6877708
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
**Version 2.0.21**
+ osx_code updated

**Version 2.0.20**
+ escape round brackets

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,9 @@ Example of configuration file:
}
]
```
**Version 2.0.21**
+ osx_code updated

**Version 2.0.20**
+ escape round brackets

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'

version = '2.0.20'
version = '2.0.21'

sourceCompatibility = '1.7'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/crowdin/cli/utils/CommandUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ public JSONObject getLanguageInfo(String language, JSONArray supportedLanguages)
langInfo.put("three_letters_code", lang.getString("iso_639_3"));
langInfo.put("crowdin_code", lang.getString("crowdin_code"));
langInfo.put("android_code", lang.getString("android_code"));
langInfo.put("osx_code", lang.getString("locale"));
langInfo.put("osx_code", lang.getString("osx_code"));
langInfo.put("osx_locale", lang.getString("osx_locale"));
break;
}
Expand Down Expand Up @@ -559,7 +559,7 @@ private Map<String, String> map(String translations, String mappingTranslations,
if (PLACEHOLDER_ANDROID_CODE.equals(pattern)) {
translations = translations.replace(pattern, languageInfo.getString("android_code"));
} else if (PLACEHOLDER_OSX_CODE.equals(pattern)) {
translations = translations.replace(pattern, Utils.getOsXLocaleCode(languageInfo.getString("crowdin_code")));
translations = translations.replace(pattern, languageInfo.getString("osx_code"));
} else if (PLACEHOLDER_OSX_LOCALE.equals(pattern)) {
translations = translations.replace(pattern, languageInfo.getString("osx_locale"));
} else {
Expand Down Expand Up @@ -589,7 +589,7 @@ private Map<String, String> map(String translations, String mappingTranslations,
if (PLACEHOLDER_ANDROID_CODE.equals(pattern)) {
replacement = languageInfo.getString("android_code");
} else if (PLACEHOLDER_OSX_CODE.equals(pattern)) {
replacement = Utils.getOsXLocaleCode(languageInfo.getString("crowdin_code"));
replacement = languageInfo.getString("osx_code");
}else if (PLACEHOLDER_OSX_LOCALE.equals(pattern)) {
replacement = languageInfo.getString("osx_locale");
} else {
Expand Down Expand Up @@ -726,7 +726,7 @@ public Map<String, String> doLanguagesMapping(JSONObject projectInfo, JSONArray
temporaryTranslationsMapping = temporaryTranslationsMapping.replace(PLACEHOLDER_FILE_EXTENTION, FilenameUtils.getExtension(f.getName()));
temporaryTranslationsMapping = temporaryTranslationsMapping.replace(PLACEHOLDER_ORIGINAL_PATH, fileParent);
temporaryTranslation = temporaryTranslation.replace(PLACEHOLDER_ANDROID_CODE, languageInfo.getString("android_code"));
temporaryTranslation = temporaryTranslation.replace(PLACEHOLDER_OSX_CODE, Utils.getOsXLocaleCode(languageInfo.getString("crowdin_code")));
temporaryTranslation = temporaryTranslation.replace(PLACEHOLDER_OSX_CODE, languageInfo.getString("osx_code"));
temporaryTranslation = temporaryTranslation.replace(PLACEHOLDER_OSX_LOCALE, languageInfo.getString("osx_locale"));
String k = this.replaceDoubleAsteriskInTranslation(temporaryTranslation, f.getAbsolutePath(), file.getSource(), propertiesBean);
String v = this.replaceDoubleAsteriskInTranslation(temporaryTranslationsMapping, f.getAbsolutePath(), file.getSource(), propertiesBean);
Expand Down Expand Up @@ -806,7 +806,7 @@ public List<String> getTranslations(String lang, String sourceFile, FileBean fil
translations = translations.replace(PLACEHOLDER_OSX_LOCALE, langsInfo.getString("osx_locale"));
}
if (translations.contains(PLACEHOLDER_OSX_CODE)) {
translations = translations.replace(PLACEHOLDER_OSX_CODE, Utils.getOsXLocaleCode(langsInfo.getString("crowdin_code")));
translations = translations.replace(PLACEHOLDER_OSX_CODE, langsInfo.getString("osx_code"));
}
List<String> projectFiles = this.getSourcesWithoutIgnores(file, propertiesBean);
String commonPath;
Expand Down Expand Up @@ -836,7 +836,7 @@ public List<String> getTranslations(String lang, String sourceFile, FileBean fil
fileParent = fileParent.replaceAll("/+", "/");
String androidLocaleCode = langsInfo.getString("android_code");
String osxLocaleCode = langsInfo.getString("osx_locale");
String osxCode = Utils.getOsXLocaleCode(langsInfo.getString("crowdin_code"));
String osxCode = langsInfo.getString("osx_code");
temporaryTranslation = temporaryTranslation.replace(PLACEHOLDER_ORIGINAL_FILE_NAME, originalFileName);
temporaryTranslation = temporaryTranslation.replace(PLACEHOLDER_FILE_NAME, fileNameWithoutExt);
temporaryTranslation = temporaryTranslation.replace(PLACEHOLDER_FILE_EXTENTION, fileExt);
Expand Down
13 changes: 0 additions & 13 deletions src/main/java/com/crowdin/cli/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,6 @@ public static String getBaseUrl() {
return applicationBaseUrl;
}

public static String getOsXLocaleCode(String localeCode) {
String osXLocaleCode = null;
if (localeCode != null && !localeCode.isEmpty()) {
if ("zh-CN".equals(localeCode.trim())) {
localeCode = "zh-Hans";
} else if ("zh-TW".equals(localeCode.trim())) {
localeCode = "zh-Hant";
}
osXLocaleCode = localeCode.replace("-", "_") + ".lproj";
}
return osXLocaleCode;
}

public static String replaceBasePath(String path, PropertiesBean propertiesBean) {
if (path == null || path.isEmpty()) {
System.out.println(RESOURCE_BUNDLE.getString("error_empty_path"));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/crowdin.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
application.name=crowdin-cli
application.version=2.0.20
application.version=2.0.21
application.base_url=https://api.crowdin.com/api/
application.user_agent=crowdin-java-cli

0 comments on commit 6877708

Please sign in to comment.