Marking some XIB/Storyboard strings as not localizable

后端 未结 3 828
孤城傲影
孤城傲影 2020-12-03 14:13

I am using Base Internationalization for XIB/Storyboard files and the \"Export for Localization\" method using XLIFF files for translators.

I have some labels, butto

3条回答
  •  余生分开走
    2020-12-03 15:04

    I add a note "DNL" to the "Comment for Localizer" field in the identity tab. Then, I run this command to automatically remove all of those elements from the XLIFF:

    xmlstarlet ed -d "//*[contains(text(), 'Note = \"DNL\"')]/.." en.xliff > out.xliff
    

    Basically, it's using xmlstarlet (which can be downloaded via homebrew) to find all elements that contain the text Note = "DNL", and then deleting the parent of that element from the XLIFF.

    Combined with using xcodebuild -exportLocalizations, you can make a pretty simple script for generating your XLIFFs:

    xcodebuild -exportLocalizations -localizationPath build -project ProjectName.xcodeproj
    xmlstarlet ed -d "//*[contains(text(), 'Note = \"DNL\"')]/.." build/en.xliff > build/out.xliff 
    

提交回复
热议问题