-
Notifications
You must be signed in to change notification settings - Fork 227
Updating localisations
Vienna's localisable strings are at the following locations:
Vienna/Interfaces/mul.lproj/*.xcstrings
Vienna/Resources/*.xcstrings
Vienna/Resources/*.lproj/Predicate.strings
Vienna Help/Resources/*.lproj/*.html
- Make the changes to the source strings
- NSLocalizedString in *.m or *.swift
- Labels or titles in Interface Builder
- Predicate.strings (Base.lproj only)
- *.html in Vienna Help (en.lproj only)
- Build the project to update the *.xcstrings files
- Commit the changes and submit a pull request
- If changes were made to Predicate.strings files, select the Vienna project in Xcode and go to File → Packages → ExpandPredicateLocalizations
- Upload the updated *.xcstrings, expanded Predicate.strings (Base.lproj only) or *.html files (en.lproj in Vienna Help only) to Crowdin
Important
Do not forget to use ExpandPredicateLocalizations if you are uploading Predicate.strings files.
- Use "Build & Download" at Crowdin
- Replace the downloaded *.xcstrings, Predicate.strings or *.html files (Vienna Help)
- Select the Vienna project in Xcode and go to File → Packages → CombinePredicateLocalizations
- Build the project
- Commit the changes and submit a pull request
Important
Do not forget to use CombinePredicateLocalizations before committing the changes to Predicate.strings files
Predicate.strings contains localisable formatting strings that are generated and used by NSPredicateEditor. If any changes are made to SmartFolder's NSPredicateEditor templates (‑[SmartFolder prepareTemplates]
) then you probably have to generate new localisable strings. NSPredicateEditor can generate these strings for you. You can access these when you go to the smart-folder editor in a development build of Vienna. There you select Development Options → Log Formatting Strings to generate new localisable strings for all predicates.
The format of these localisable strings is more sophisticated than other formatting strings. The formatting strings will affect how the user interface will look in the smart-folder editor.
For example:
"%[Read]@ is %[Yes]@" = "%1$[Is read]@ %2$[Yes]@";
will look like this:
and:
"%[Subject]@ %[contains]@ %@" = "%1$[Subject]@ %2$[contains]@ %3$@";
will look like this:
Text between %[
]@
is displayed as a pop-up button or a label; text outside will always be displayed as a label. Arguments without square brackets (%@
) are replaced by a different control, such as a text field. The arguments on the right side are numbered, e.g. %1$[
]@
, %2$[
]@
, %3$@
. NSPredicateEditor might create a row of user-interface components for each string, but will merge arguments where possible into pop-up buttons. Text can be put inside or outside of the square brackets so that it is shown as a pop-up button or a label. The numbered arguments can also be repositioned. NSPredicateEditor will ultimately combine all formatting strings and group similar items together, going from left to right. For this reason it is important to follow some rules:
- Make sure that the first numbered variable is not repositioned
- Try to adhere to a hierarchy, going from left to right, from general to specific
- Format strings that belong together in the same way to make the user interface as simple as possible
Vienna has three Swift Package plug-ins available to help with Predicate.strings:
- CombinePredicateLocalizations: This will merge formatting strings together and makes it easier to see how complex the user interface might be.
- ExpandPredicateLocalizations: This will undo CombinePredicateLocalizations and show each each formatting string as its own localised strings.
- ComparePredicateLocalizations: This will compare the Predicate.strings of Base.lproj to localised Predicate.strings and check for inconsistencies.