iOS Strings
Extension | .strings |
Smartling Identifier | ios |
Resources | String Resources |
When downloading translated iOS Strings files via the File API, setting the parameter includeOriginalStrings=false will strip untranslated elements from the file.
Keys/Variants
Every string is created with key/variant metadata based on the keys in the file. If the keys are different for two strings with the same value, Smartling will create two strings using the key as context metadata.
String Instructions
Smartling will automatically ingest and display file comments as instructions for translators. The comments must immediately precede the string. For example, for the following comment, the text “Back button label” will be captured as a file instruction
Text
/* Back button label */
"Back" = "Back";
If the comment contains the following text: ~ / No comment provided by engineer. / ~
or if a line separates the comment and string, such as:
Text
/* Back button label */
"Back" = "Back";
Smartling will not create an instruction.
Standard Placeholder Format
By default, Smartling recognizes ios-style placeholders in iOS String files.
See Placeholders in Resource Files for more on placeholders.
Placeholders in iOS files are numbered when downloaded from Smartling. Placeholder numbering follows the guidelines set by Apple:
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html
iOS Placeholder Numbering
One problem that often occurs during translation is that the translator may need to reorder parameters inside translated strings to account for differences in the source and target languages. If a string contains multiple arguments, the translator can insert special tags of the form n$ (where n specifies the position of the original argument) in between the formatting characters. These tags let the translator reorder the arguments that appear in the original string. The following example shows a string whose two arguments are reversed in the translated string:
/ Message in alert dialog when something fails /
"%@ Error! %@ failed!" = "%2$@ blah blah, %1$@ blah!";
Directives
Format
// smartling.[directive_name] = [value] |
entity_escaping
Exact delivery depends on file type.
Values | auto (default) true (or yes) false (or no) |
Description | Can control whether or not characters will be "escaped" into entities when delivering translations. This can be set universally for the whole file via API, or by setting the directive at the top/start of the file. The directive can also be placed inline to control the behavior of specific strings. |
Examples |
(Note: Exact delivery depends on file type.) To use inline: String:
|
For example, your translation might look like this:
Smartling HTML escaping < > & " example string4
By default, using the "auto" setting, we would assume this is HTML from the <hr> tag and it would be converted to:
Smartling HTML escaping < > & " example string4
Using // smartling.entity_escaping = false
would allow Smartling HTML escaping < > & " example string4
to appear as it should.
placeholder_format
Values | NONE; C; IOS; PYTHON; JAVA; YAML; QT; RESX |
Description | Used to specify a standard placeholder format. |
Examples |
// smartling.placeholder_format = IOS Specifies iOS-style placeholders for the file. |
placeholder_format_custom
Values |
1) Custom Perl compatible regular expression. 2) NONE - disables any current custom placeholders |
Description | Specifies a custom placeholder format. Any text in your file matching the regular expression you provide will be captured as a placeholder. |
Examples |
// smartling.placeholder_format_custom = [.+?] Any characters surrounded by square brackets will be treated as a placeholder. |
pseudo_inflation
Values | integer - Accepted values are 0 - 100 |
Description | Sets the percentage by which original strings are inflated when downloading pseudo translations. If this directive is not set, pseudo translations are 30 percent longer than the original strings. |
Examples |
// smartling.pseudo_inflation = 80 Downloaded pseudo translations will increase the length of original strings by 80 percent. |
character_limit
Values | integer or NONE |
Description | Sets or removes the maximum characters allowed for a translation. If NONE is specified, character limits will be removed. |
Examples |
// smartling.character_limit = 25 The directive should go directly before the string where the character limit should be applied. This will apply a character limit of 25 to the string on the line after the directive. // smartling.character_limit = NONE This will remove any character limits set for a string even if the character limit was set manually in the Dashboard |