-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support .xtb translation autodiscovery (#172)
This is the next commit in adding first-class support for xtb files for closure compilation from Java apps and libraries. If the newly added "auto" flag is set, the closure task will find the first .xtb file that matches the desired locale and use that. Future work will merge discovered xtb files, both across dependencies and locales. Co-authored-by: Colin Alworth <[email protected]>
- Loading branch information
1 parent
487473f
commit 47710a8
Showing
18 changed files
with
357 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
j2cl-maven-plugin/src/it/translationsfile/tests/pom_cz_auto.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>translation.test</groupId> | ||
<artifactId>cz-auto</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.jsinterop</groupId> | ||
<artifactId>base</artifactId> | ||
<version>1.0.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.vertispan.j2cl</groupId> | ||
<artifactId>junit-annotations</artifactId> | ||
<version>@j2cl.version@</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.vertispan.j2cl</groupId> | ||
<artifactId>junit-emul</artifactId> | ||
<version>@j2cl.version@</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.vertispan.j2cl</groupId> | ||
<artifactId>junit-emul</artifactId> | ||
<version>@j2cl.version@</version> | ||
<classifier>sources</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.6.1</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>test-js</id> | ||
<goals> | ||
<goal>test</goal> | ||
</goals> | ||
<configuration> | ||
<!-- In order to use htmlunit, we must compile to remove es6 classes --> | ||
<compilationLevel>ADVANCED</compilationLevel> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<translationsFile> | ||
<auto>true</auto> | ||
</translationsFile> | ||
<defines> | ||
<goog.LOCALE>cz</goog.LOCALE> | ||
<holder.value>Asi se něco stalo!</holder.value> | ||
</defines> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
j2cl-maven-plugin/src/it/translationsfile/tests/pom_de_in_java_package-auto.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>translation.test</groupId> | ||
<artifactId>de_in_java_package_auto</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0</version> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>com.google.jsinterop</groupId> | ||
<artifactId>base</artifactId> | ||
<version>1.0.0</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.vertispan.j2cl</groupId> | ||
<artifactId>junit-annotations</artifactId> | ||
<version>@j2cl.version@</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.vertispan.j2cl</groupId> | ||
<artifactId>junit-emul</artifactId> | ||
<version>@j2cl.version@</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.vertispan.j2cl</groupId> | ||
<artifactId>junit-emul</artifactId> | ||
<version>@j2cl.version@</version> | ||
<classifier>sources</classifier> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.6.1</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>test-js</id> | ||
<goals> | ||
<goal>test</goal> | ||
</goals> | ||
<configuration> | ||
<!-- In order to use htmlunit, we must compile to remove es6 classes --> | ||
<compilationLevel>ADVANCED</compilationLevel> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<translationsFile> | ||
<auto>true</auto> | ||
</translationsFile> | ||
<defines> | ||
<goog.LOCALE>de</goog.LOCALE> | ||
<holder.value>Ich schätze, es ist etwas passiert!</holder.value> | ||
</defines> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
j2cl-maven-plugin/src/main/java/com/vertispan/j2cl/mojo/TranslationsFileConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.vertispan.j2cl.mojo; | ||
|
||
public class TranslationsFileConfig { | ||
|
||
private boolean auto; | ||
private String file; | ||
|
||
public boolean isAuto() { | ||
return auto; | ||
} | ||
|
||
public void setAuto(boolean auto) { | ||
this.auto = auto; | ||
} | ||
|
||
public String getFile() { | ||
return file; | ||
} | ||
|
||
public void setFile(String file) { | ||
this.file = file; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.