Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.2 KB

README_JAVASCRIPT.md

File metadata and controls

39 lines (29 loc) · 1.2 KB

Getting Started with a Web project with Javascript Files

pom.xml

In order to execute a maven plugin, you would need to have a pom.xml file. This fragment will be necessary for this plugin:

<build>
  <plugins>
    <plugin>
      <!-- https://mvnrepository.com/artifact/de.pentabyte.tools/i18n-maven-plugin -->
      <groupId>de.pentabyte.tools</groupId>
      <artifactId>i18n-maven-plugin</artifactId>
      <version>1.2.3</version>
      <configuration>
        <tableDirectory>${basedir}</tableDirectory>
      </configuration>
    </plugin>
  </plugins>
</build>

This example configuration will make the plugin scan your basedir for i18n.xml files and will create JSON files as such: i18n_{locale}.js.

Results

Usage

Unlike other target language files, you can instantly access the translations like this:

alert(i18n.form.validation.required$);

Please note the dollar sign, which acts as 'terminator'. Without it, Javascript would not be able to tell if you are about to access the tree structure or a concrete value.