Force genstrings to build the Localizable.strings file in order of appearance rather than alphabetically
Asked Answered
A

2

8

I'm new to internationalization and localization for iOS. I'm running genstrings: find . -name \*.m | xargs genstrings -o en.lproj to generate my Localizable.strings files. It builds the file in alphabetical order (by key).

For ease of translation I'd prefer that the keys and values be ordered by their order of appearance in the .m files. Is this possible with genstrings? I couldn't find the relevant info on its man page.

Aruwimi answered 17/7, 2012 at 16:28 Comment(0)
P
4

It is not possible to change the behavior of genstrings other than what it is allowed within the parameters specified in the manual:

https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/genstrings.1.html

but if you want to ease the translation you can use Linguan

http://www.cocoanetics.com/apps/linguan/

If you want to stick to genstrings and are having some trouble with it you can try this page, it offers a good explanation:

http://spritebandits.wordpress.com/2012/01/25/ios-iphone-app-localization-genstrings-tips/

But yeah returning to the main question, it is not possible in my knowledge.

Paphos answered 23/7, 2012 at 5:23 Comment(2)
Great, thanks for confirming this and providing some helpful info.Aruwimi
Downloaded Linguan and it seems like a very capable app. Thx for the info!Befool
Z
5

You could do something like:

find . -name '*.m' -print | xargs -n1 genstrings -a

I'm sure there are more elegant ways. Perhaps just use ls *.m instead of the find. The strings are kept together by file with -a switch but they are still sorted within each file.

Zamudio answered 23/7, 2012 at 16:12 Comment(1)
Thanks, your use of -n1 in combination with -a at least got me half the way by sorting each .m file separately.Aruwimi
P
4

It is not possible to change the behavior of genstrings other than what it is allowed within the parameters specified in the manual:

https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/genstrings.1.html

but if you want to ease the translation you can use Linguan

http://www.cocoanetics.com/apps/linguan/

If you want to stick to genstrings and are having some trouble with it you can try this page, it offers a good explanation:

http://spritebandits.wordpress.com/2012/01/25/ios-iphone-app-localization-genstrings-tips/

But yeah returning to the main question, it is not possible in my knowledge.

Paphos answered 23/7, 2012 at 5:23 Comment(2)
Great, thanks for confirming this and providing some helpful info.Aruwimi
Downloaded Linguan and it seems like a very capable app. Thx for the info!Befool

© 2022 - 2024 — McMap. All rights reserved.