objective c - How do I use Twine with my Xcode Project? -



objective c - How do I use Twine with my Xcode Project? -

twine looks great, documentation bit lacking, , there no sample ios project. i'm wondering how incorporate tool project.

specifically:

is recommended keys arbitrary codes (e.g. path_not_found_error) or english language words/sentences apple recommends (e.g. unable find path). the article introduces twine mentions how english language words/sentences fall short when single word mean 2 different things (e.g. list noun vs. verb), mentions drawbacks of using keys: if forget include one, user see key name (path_not_found_error) rather english language counterpart (unable find path). say i'm writing code , want include new string. steps in order so? when next apple's recommendation, can type nslocalizedstring(@"sample text", nil), , done. process in order working twine? in their examples, show categories such [[general]] , [[errors]]. how categorize string? in their examples, show tags. these, , how utilize them?

to generate first version of strings.txt:

generate localizable.strings nslocalizedstring macros in code.

find . -name \*.m | xargs genstrings -o /tmp

it recommended save in resources/locales/en.lproj/localizable.strings

create initial, empty strings.txt file:

touch strings.txt

populate contents of localizable.strings:

twine consume-all-string-files strings.txt resources/locales --developer-language en --consume-all --consume-comments

it seems after doing once, it's recommended manually modify strings.txt file going forward.

to create new string in code:

type in string want use, example:

nsstring *prompt = nslocalizablestring(@"prompt_user_name", nil);

manually add together key/value strings.txt file, optionally placing them in category:

[prompt_user_name] en = please come in in user name

now when build project, generate localizable.strings , when run app see right string. (assuming followed twine , build process steps.)

objective-c localization

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -