Fix localization task hints#2031
Conversation
| System.out.println("1. CAREFULLY CHECK IF THE KEY IS REALLY NOT USED ANYMORE"); | ||
| System.out.println("2. REMOVE THESE FROM THE ENGLISH LANGUAGE FILE"); | ||
| System.out.println("3. EXECUTE gradlew -b localization.gradle generateMissingTranslationKeys TO"); | ||
| System.out.println("3. EXECUTE gradlew update"); |
There was a problem hiding this comment.
This should be gradlew -b localization.gradle update, right?
There was a problem hiding this comment.
Nope, localization.gradle is imported in the build.gradle file, thus gradle knows the tasks form localization.gradle too.
| System.out.println(); | ||
| System.out.println("1. REMOVE THESE FROM THE ENGLISH LANGUAGE FILE"); | ||
| System.out.println("2. EXECUTE gradlew -b localization.gradle generateMissingTranslationKeys" + " TO"); | ||
| System.out.println("3. EXECUTE gradlew update"); |
There was a problem hiding this comment.
see above, but fixed wrong item enumeration.
|
|
||
| private String convertPropertiesFile(List<LocalizationEntry> missingKeys) { | ||
| System.out.println("EXECUTE gradlew -b localization.gradle generateMissingTranslationKeys TO"); | ||
| System.out.println("EXECUTE gradlew update"); |
| Tests fail. In the test output a snippet is generated which must be added to the English translation file. There is also a snippet generated for the non-English files, but this is irrelevant. | ||
| Add snippet to English translation file located at `src/main/resources/l10n/JabRef_en.properties` | ||
| With `gradlew generateMissingTranslationKeys` the "KEY" is added to the other translation files as well. | ||
| With `gradlew update` the "KEY" is added to the other translation files as well. |
There was a problem hiding this comment.
Hm, I don't like the current task name. It should say what it does, like updateLocalization. Please also change the other Gradle tasks accordingly.
There was a problem hiding this comment.
You're right. I use the gradle tasks out of IntelliJ IDEA which groups them by its category.
I added localization as a prefix to each of them.
There was a problem hiding this comment.
I also use them that way, thats the reason why I only realized this problem when looking at the PR code.
| System.out.println(); | ||
| System.out.println("1. REMOVE THESE FROM THE ENGLISH LANGUAGE FILE"); | ||
| System.out.println("3. EXECUTE gradlew update"); | ||
| System.out.println("2. EXECUTE gradlew localizationUpdate"); |
There was a problem hiding this comment.
If you already touch the localization tests, could you also remove the System.out.println statements by moving everything to the error message.
So for example this here should be
assertEquals("Obsolte kyes found in menu properties file. \n 1. Remove these... \n 2...", emptyList, obsolteKeys)
tobiasdiez
left a comment
There was a problem hiding this comment.
Looks good and can be merged. Just fix the emptyList thing before.
| missingKeys.parallelStream() | ||
| .map(key -> String.format("%s=%s", key.getKey(), key.getKey())) | ||
| .collect(Collectors.toList()), | ||
| Collections.EMPTY_LIST, missingKeys); |
There was a problem hiding this comment.
Collections.emptyList() is the preferred way to access it (don't ask me why).
There was a problem hiding this comment.
The advantage of Collections.EMPTY_LIST is that this list is immutable.
Collections.emptyList() is also immutable.
There was a problem hiding this comment.
Collections.emptyList() is better because it is a generic implementatin! The constant is not generic
There was a problem hiding this comment.
And it's also immuntable: https://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#emptyList--
(Unlike this method, the field does not provide type safety.)
There was a problem hiding this comment.
Thanks, I changed the lists.
| .map(key -> String.format("%s=%s", key.getKey(), key.getKey())) | ||
| .collect(Collectors.toList()), | ||
| Collections.EMPTY_LIST, missingKeys); | ||
| Collections.<LocalizationEntry>emptyList(), missingKeys); |
There was a problem hiding this comment.
Just for the future, you could have just taken the Collections.emptyList() without specifying the type explicit.
Siedlerchr
left a comment
There was a problem hiding this comment.
Okay, now looks good!
Failing test is not related
* upstream/master: Implemented Integrity NoBibtexFieldChecker (#2059) Implemented title and camel key modifiers (#1894) Fix localization task hints (#2031) Result of syncLang.py update Result of syncLang.py update (with manual correction of captial_letters, and The_BibTeX_entry...) Fix "large capitals" to "capital letters" Updated Menu_tr.properties (#2057) Updated jabref_tr.properties (#2056) fix ignore version (#2055) Towards hierarchical keywords (#1950) Fix failing test, replace \uxxx encoded chars with proper UTF8 chars. Import Italian patch
* fixLocalizationTaskHint * added prefix to each of the gradle task names * replace system.out with asserts in localization tests
fixes: #2029
Replaces hints to the old gradle localization task names with the new ones.