Xcode i18n
Xcodei18n
Vorbereitungen
- Select Project -> Info -> Localisation: Gewünschte hinzufügen
- Select Project -> Product -> Export Localisation (From MainMenu)
- Open xliff file with appropriate app
- Translate
- Editor -> Import
Coding
String(localized: "YOUR_LOCALIZED_KEY")
NSLocalizedString("Abenteuer", comment: "") String(format: NSLocalizedString("%d Units in: %@", comment: ""), inventoryItem.amount, inventoryItem.place.title)
Pluralisation
String.localizedStringWithFormat(NSLocalizedString("%d unit(s) in: %@", comment: "Message for stock in place"), self.amount, self.place.title) 1. Neue plist erzeugen und in "Localizable.stringsdict" umbenennen 2. Vorlage verwenden 3. Stringsdict localisieren
Vorlage:
<plist version="1.0"> <dict> <key>%d file(s) remaining</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@files@</string> <key>files</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>d</string> <key>one</key> <string>%d file remaining</string> <key>other</key> <string>%d files remaining</string> </dict> </dict> </dict> </plist>
Referenzen:
Meta data
★★★★★
- Date
- March 21, 2020over 4 years ago
- Language
- de
- Updated on
- October 19, 2024