Strings
The.strings format is used to surface text in iOS applications. If you’re fetching this format via the API, it will have an HTTP Content-Type header of text/plain.
Example:
?format=ios-strings.
To fetch this via the CLI, specify format: ios-strings in the config.yml file.
Format details:
- Ditto Variables are replaced with interpolation placeholders with a string (@) format specifier; in your client code, you’ll need to ensure that all variables passed as arguments are first converted into strings.
- Notes associated with text items or components will be included as comments above a given key-value pair.
- To use string plural forms, you will need to use the .stringsdictformat (see below) in conjunction with the.stringsformat.
- If this format is exported for a specific variant, two comments containing variant metadata will also be included:
StringsDict
The.stringsdict format is used to surface plural form text in iOS applications; text without pluralization enabled in Ditto is excluded from output.
For integrating strings that are not pluralized, you should use .stringsdict in conjunction with iOS .strings.
If you’re fetching this format via the API, it will have an HTTP Content-Type header of text/xml.
Example:
?format=ios-stringsdict.
To fetch this via the CLI, specify format: ios-stringsdict in the config.yml file.
Format details:
The order in which variables are provided as arguments in Swift is relevant to the output. The following code could be used with the example output above:
- A comment structured like <!-- Variables: variable_one, variable_two, ... -->is included above each key in the.stringsdictfile to indicate the order in which variables should be passed (this will always be alphabetical).
- All Ditto Variables are replaced with interpolation placeholders with a string (@) format specifier — in your client code, you’ll need to ensure that all variables passed as arguments are first converted into strings.
- If this format is exported for a specific variant, two comments containing variant metadata will also be included: