-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix localization task hints #2031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
@@ -156,7 +156,7 @@ public void findObsoleteLocalizationKeys() throws IOException { | |||
System.out.println(); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be gradlew -b localization.gradle update
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, localization.gradle
is imported in the build.gradle
file, thus gradle knows the tasks form localization.gradle
too.
@@ -172,7 +172,7 @@ public void findObsoleteMenuLocalizationKeys() throws IOException { | |||
System.out.println(obsoleteKeys.stream().map(Object::toString).collect(Collectors.joining("\n"))); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above, but fixed wrong item enumeration.
@@ -197,7 +198,7 @@ private String convertToEnglishPropertiesFile(List<LocalizationEntry> missingKey | |||
} | |||
|
|||
private String convertPropertiesFile(List<LocalizationEntry> missingKeys) { | |||
System.out.println("EXECUTE gradlew -b localization.gradle generateMissingTranslationKeys TO"); | |||
System.out.println("EXECUTE gradlew update"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@@ -85,7 +85,7 @@ because <additional rationale>. | |||
Add new Localization.lang("KEY") to Java file. | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also use them that way, thats the reason why I only realized this problem when looking at the PR code.
@@ -172,7 +172,7 @@ public void findObsoleteMenuLocalizationKeys() throws IOException { | |||
System.out.println(obsoleteKeys.stream().map(Object::toString).collect(Collectors.joining("\n"))); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collections.emptyList() is the preferred way to access it (don't ask me why).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advantage of Collections.EMPTY_LIST
is that this list is immutable.
Collections.emptyList()
is also immutable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collections.emptyList() is better because it is a generic implementatin! The constant is not generic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I changed the lists.
@@ -128,7 +128,7 @@ public void findMissingLocalizationKeys() throws IOException { | |||
missingKeys.parallelStream() | |||
.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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the future, you could have just taken the Collections.emptyList() without specifying the type explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.