Skip to content
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

Fix localization task hints #2031

Merged
merged 4 commits into from
Sep 25, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Tests are green again.

You can also directly run the specific test in your IDE. The test "LocalizationConsistencyTest" is placed under `src/test/java/net.sf.jabref.logic.l10n/LocalizationConsistencyTest.java`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Copy link
Member

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?

Copy link
Contributor Author

@chriba chriba Sep 22, 2016

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.

System.out.println("REMOVE THESE FROM THE NON-ENGLISH LANGUAGE FILES");
fail("Obsolete keys " + obsoleteKeys + " found in properties file which should be removed");
}
Expand All @@ -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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Contributor Author

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.

System.out.println("REMOVE THESE FROM THE NON-ENGLISH LANGUAGE FILES");
fail("Obsolete keys " + obsoleteKeys + " found in menu properties file which should be removed");
}
Expand All @@ -189,6 +189,7 @@ private void printInfos(List<LocalizationEntry> missingKeys) {

private String convertToEnglishPropertiesFile(List<LocalizationEntry> missingKeys) {
System.out.println("PASTE THIS INTO THE ENGLISH LANGUAGE FILE");
System.out.println("AND EXECUTE gradlew update");
StringJoiner result = new StringJoiner("\n");
for (LocalizationEntry key : missingKeys) {
result.add(String.format("%s=%s", key.getKey(), key.getKey()));
Expand All @@ -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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

System.out.println("PASTE THIS INTO THE NON-ENGLISH LANGUAGE FILES");
StringJoiner result = new StringJoiner("\n");
for (LocalizationEntry key : missingKeys) {
Expand Down