Closed simon04 closed 2 years ago
@simon04 Do you read the josm-dev list? Can you help me create the .pot and .lang files using ant? I seem to be missing pieces of the puzzle...
I'm not really familiar with how this is done with Ant on GitHub.
In #12 there is a simple shell script that could extract a *.pot
file from the sources.
I believe the precondition to using Launchpad translation is to have your plugin added as svn:external
here: https://josm.openstreetmap.de/browser/osm/applications/editors/josm/plugins
And I think the precondition for that is to transfer your plugin into the JOSM
group on GitHub.
Then the *.pot
file would be automatically be uploaded to Launchpad and the JOSM maintainers would update the *.lang
files.
That process uses some perl scripts located here: https://josm.openstreetmap.de/browser/osm/applications/editors/josm/i18n
For my projects I'm usually using the gradle-josm-plugin
, which can generate the *.pot
file and later generate *.lang
files from *.po
files, regardless where the JOSM plugin is hosted.
@floscher I've merged your #13 - thank you, that makes building the plugin so much easier. Alas, I managed to get a .pot (generatePot
) and build myself a de.po
using POEdit, but how do I get on from there? I thought that compilePo
was the next step, but I don't seem to get where I have to place them for creating a .lang. Could you enlightend me?
@kmpoppe When you put the translated .po files in a new src/main/po
directory, they should be picked up automatically.
The compilePo
task will be executed when needed, so you don't have to call that explicitly. Just do e.g. ./gradlew dist
and the built .jar file should contain the translations.
@floscher Thanks! Things I learned: I need to give it a specific English translation file, otherwise JOSM will pick the only other avaiable translation. Welp ;-)
Does runJosm
force it to be English? I have changed the settings to use German (de) - which also gets saved in the properties correctly - but the UI is still English ... or is this just unfortunate timing because josm.openstreetmap.de is currently broken?
@kmpoppe Can you explain the problem, that you need an English translation file, in a bit more detail? Normally an en.po
file should not be needed. This might be a bug with the gradle-josm-plugin, if you indeed have to create an en.po
file to get it to work. Maybe you could open an issue on GitLab or GitHub for that.
The issue with runJosm
always using English texts is a known problem. I'm not really sure what causes this, but somehow JOSM can't read the translations from JOSM core, but only the translations for your plugin. So everything is in English, except the strings that are in the *.po files for your plugin. But this is only a problem when starting through runJosm
, when the plugin is installed normally to JOSM, everything should work fine.
@kmpoppe Ah, I think I know what went wrong. The .po files need to be named just with the language abbreviation, so just name it de.po
, the same as the .lang files are named.
@floscher Yeah, i figured, after seeing a .lang file in the .jar, that this should be the case. Alas, the file names are the direct export of poeditor.com, so I'll just have to rename them here in the repo.
Please use @JOSM's class
I18n
for internationalization support, for instance: