miracle2k / android2po

Convert Android string resources to gettext, and back.
BSD 2-Clause "Simplified" License
126 stars 50 forks source link

Merge arrays-*.po (and arrays.pot) and strings-*.po (and strings.pot) #29

Open murraycu opened 9 years ago

murraycu commented 9 years ago

Translators expect to deal with only one .po file, so it's awkward that we a2po generates a separate set of po/pot files for each XML file that has translatable strings. It would be great if they could be merged into one file, though I guess there would need to be some marker to identify the source so they could be imported back into the correct XML again.

miracle2k commented 9 years ago

Is it possible this is already supported? What happens if you don't have a %(group)s in your layout?

See https://github.com/miracle2k/android2po/blob/master/example.config#L33

murraycu commented 9 years ago

Sorry, I've read that but I don't understand what I should try.

My .android2po file did look like this: --android app/src/main/res --gettext app/src/main/locale So I don't seem to be using a group.

I tried making my .android2po file look like this, as suggested in that documentation, just to see what happens: --android app/src/main/res --gettext app/src/main/locale --layout %(locale)/%(domain)/%(group).po

But then I get this error: Error: --layout lacks %(locale)s variable

Thanks and sorry if I'm not seeing something obvious.

miracle2k commented 9 years ago

Try this:

 --layout %(locale)s.po

Note the s at the end of the variable. My hope is that the lack of %(group)s will mean the different xml resource are merged, but maybe it is not implemented.

murraycu commented 9 years ago

Thanks, but I then get this error:

Error: --layout needs %(group)s variable, since you have multiple groups: arrays, strings

For now, I am just putting everything in strings.xml to avoid the problem. I didn't realize before that I could put s in strings.xml.