Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 1.71 KB

I18n.md

File metadata and controls

46 lines (31 loc) · 1.71 KB

I18n

Extracting string from the source code

Run ./gradlew generatePot and you will find a *.pot file in the directory $buildDir/i18n.

Adding files, which you get back from the translators

After the translators did their work, they will give you a file back, probably in one of the three formats below. *.po and *.mo are file formats of GNU gettext, while *.lang files are in a custom format created for JOSM.

If you wanted, you could even mix these formats, but that's not recommended.

Using translated *.po files

Put the files in the directory src/$sourceSetName/po (e.g. src/main/po), then build normally and the files should be picked up.

Note: If you use *.po files, you'll need xgettext to build your JOSM plugin with internationalisation. Everyone who does not have xgettext installed can still build the project, but these builds are then not internationalised.

Using translated *.mo files

Put the files in the directory src/$sourceSetName/mo, then build normally and the files should be picked up.

Using translated *.lang files

Put the files in the directory src/$sourceSetName/lang, then build normally and the files should be picked up.

Change the path from where translated files are picked up

If you want to put your translated files in another location, add the relevant parts of the following snippet to your build.gradle and modify it according to your needs:

sourceSets {
  main { // you can do that for any source set, doesn't have to be `main`
    po {
      setSrcDirs(setOf("new/po/source/directory"))
    }
    mo {
      setSrcDirs(setOf("new/mo/source/directory"))
    }
    lang {
      setSrcDirs(setOf("new/lang/source/directory"))
    }
  }
}