Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When exporting XLIFF from Xcode, how to exclude dummy strings?

I'm using the Xcode's Editor > Export For Localization... to export XLIFF file for translation but the translations for the Main.storyboard includes a lot of unnecessary strings, mostly placeholders/dummies that are useful at design time.

How do I exclude such strings from XLIFF file?

like image 589
plam4u Avatar asked Apr 29 '15 14:04

plam4u


1 Answers

I've written a script that excludes certain translation.

How it works?
cmd-line: python strip_loc.py input.xliff output.xliff exclude_list.txt [-v]

Example usage:
python strip_loc.py en.xliff en-stripped.xliff exclude_words.txt -v

The exclude_list.txt is a file with a string per line. The script parses this list and creates a dictionary of banned words. If a translation with source containing one of these strings is encountered, the whole translation unit is removed from the output xml/xliff.

like image 68
plam4u Avatar answered Oct 25 '22 19:10

plam4u