iOS应用本地化:如何添加德语Localizable文件
如何为iOS项目添加德语Localizable文件
Hey there! Adding German localization to your iOS project is straightforward, and here are two reliable ways to do it based on your existing setup with English and French support:
方法1:通过Xcode本地化面板添加(推荐)
This is the most seamless way since you already have existing Localizable files:
- Open your Xcode project and locate your existing
Localizable.stringsfile in the project navigator. - Select the file, then open the Inspectors panel (click the rightmost icon in the top-right corner, or use the shortcut
Cmd + Option + 0). - Scroll down to the Localization section, click the + button, and select German (de) from the dropdown menu.
- Xcode will automatically create a
de.lprojfolder in your project and generate a German-specificLocalizable.stringsfile inside it. - Open the German
Localizable.stringsfile, then add your translated key-value pairs—make sure the keys match exactly with your English/French versions. For your example:"ReJoin Now" = "Jetzt wieder beitreten";
方法2:手动创建本地化文件
If you prefer a hands-on approach or run into issues with the first method:
- Create a new
Strings Filein Xcode (go toFile > New > File..., search for "Strings File", and name itLocalizable.strings). - Right-click the new file and select Show in Finder.
- In Finder, create a new folder named
de.lproj(this naming is critical—iOS uses standard language codes likedefor German, paired with.lprojto recognize localization folders). - Drag the new
Localizable.stringsfile into thede.lprojfolder, then switch back to Xcode and confirm the file is added to your project. - Edit the German
Localizable.stringsfile with your translations, following the same key-value format as above.
验证本地化是否生效
To make sure everything works as expected:
- Switch your simulator/device's system language to German, then run your app and check if the localized text appears.
- Or test directly in code by forcing the German bundle (great for quick checks without changing system settings):
if let germanBundlePath = Bundle.main.path(forResource: "de", ofType: "lproj"), let germanBundle = Bundle(path: germanBundlePath) { let testText = NSLocalizedString("ReJoin Now", bundle: germanBundle, value: "", comment: "") print(testText) // Should output your German translation }
内容的提问来源于stack exchange,提问作者Abhishek Sharma
相关产品推荐
相关产品推荐

