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 update` the "KEY" is added to the other translation files as well.
With `gradlew localizationUpdate` the "KEY" is added to the other translation files as well.
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
10 changes: 5 additions & 5 deletions localization.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies {
jython 'org.python:jython-standalone:2.7.0'
}

task statusWithMarkdown(type: JavaExec) {
task localizationStatusWithMarkdown(type: JavaExec) {
description "Creates an update file in Markdown"
group = 'Localization'
main 'org.python.util.jython'
Expand All @@ -19,7 +19,7 @@ task statusWithMarkdown(type: JavaExec) {
args "markdown"
}

task status(type: JavaExec) {
task localizationStatus(type: JavaExec) {
description "Prints the current status"
group = 'Localization'
main 'org.python.util.jython'
Expand All @@ -28,7 +28,7 @@ task status(type: JavaExec) {
args "status"
}

task statusExtended(type: JavaExec) {
task localizationStatusExtended(type: JavaExec) {
description "Prints the current status (extended output)"
group = 'Localization'
main 'org.python.util.jython'
Expand All @@ -38,7 +38,7 @@ task statusExtended(type: JavaExec) {
args "--extended"
}

task update(type: JavaExec) {
task localizationUpdate(type: JavaExec) {
description "Updates the localization files (fixes duplicates, adds missing keys, and sort them"
group = 'Localization'
main 'org.python.util.jython'
Expand All @@ -47,7 +47,7 @@ task update(type: JavaExec) {
args "update"
}

task updateExtended(type: JavaExec) {
task localizationUpdateExtended(type: JavaExec) {
description "Updates the localization files (fixes duplicates, adds missing keys, and sort them (extended output)"
group = 'Localization'
main 'org.python.util.jython'
Expand Down
10 changes: 5 additions & 5 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ The Script has following commands available
- prints the current status to the terminal
- `[--extended]` if the translations keys which create problems should be printed
- usable with Gradle tasks
- `$ gradle status`
- `$ gradle statusExtended`
- `$ gradle localizationStatus`
- `$ gradle localizationStatusExtended`


- `$ python scripts/syncLang.py markdown`
- Creates a markdown file of the current status and opens it
- usable with Gradle tasks
- `$ gradle statusWithMarkdown`
- `$ gradle localizationStatusWithMarkdown`


- `$ python scripts/syncLang.py update [--extended]`
- compares all the localization files against the English one and fixes unambiguous duplicates, removes obsolete keys, adds missing keys, and sorts them
- `[--extended]` if the translations keys which create problems should be printed
- usable with Gradle tasks
- `$ gradle update`
- `$ gradle updateExtended`
- `$ gradle localizationUpdate`
- `$ gradle localizationUpdateExtended`
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 update");
System.out.println("3. EXECUTE gradlew localizationUpdate");
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("3. EXECUTE gradlew update");
System.out.println("2. EXECUTE gradlew localizationUpdate");
Copy link
Member

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

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,7 +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");
System.out.println("AND EXECUTE gradlew localizationUpdate");
StringJoiner result = new StringJoiner("\n");
for (LocalizationEntry key : missingKeys) {
result.add(String.format("%s=%s", key.getKey(), key.getKey()));
Expand All @@ -198,7 +198,7 @@ private String convertToEnglishPropertiesFile(List<LocalizationEntry> missingKey
}

private String convertPropertiesFile(List<LocalizationEntry> missingKeys) {
System.out.println("EXECUTE gradlew update");
System.out.println("EXECUTE gradlew localizationUpdate");
System.out.println("PASTE THIS INTO THE NON-ENGLISH LANGUAGE FILES");
StringJoiner result = new StringJoiner("\n");
for (LocalizationEntry key : missingKeys) {
Expand Down