Search code examples
iosxcodeswiftgenstrings

How do you access Genstrings in Xcode?


I'm currently using a pod that helps switch between languages. Part of the installation process is as follows:

To support this new i18n syntax, Localize-Swift includes custom genstrings swift and python scripts.

Copy the genstrings file (either .swift or .py) into your project's root folder and run with

./genstrings.swift
or

python genstrings.py
This will print the collected strings in the terminal. Select and copy to your default Localizable.strings.

The swift genstrings includes the ability to specify excluded directories and files (by editing the script).

I'm not familiar with genstrings and don't really know what the writer is referring to. I'm guessing the writer meant my localized string folder but when I ran a terminal on it I got this error:

-bash: ./genstrings.swift: No such file or directory

Any idea what the instructions mean?


Solution

  • I see you are using Localize-Swift. The README in that project says you need to copy the genstring.swift file into the root of your project and run it from the command line. That works for me.