Xcode - exclude certain strings from localization
Asked Answered
R

2

13

When localizing my storyboard, I get entries in my strings file that look like:

/* Class = "NSTextFieldCell"; title = "Text Cell"; ObjectID = "vHF-LZ-23i"; */ "vHF-LZ-23i.title" = "Text Cell";

Is there anyway to exclude dummy text or other strings from going into the storyboard localization strings files?

Restoration answered 5/8, 2015 at 23:31 Comment(4)
No, there is no such option as I know.Asterism
Can't you just remove them from the file?Hydroxylamine
This file is generated whenever the localization strings change so that isn't a great solutionRestoration
See #27407782 for a potential workaround for this issue.Snappish
U
7

As Jenszcz mentioned in his comment that you can solve this problem by using BartyCrouch open-source project, I was curios to give it a try And worked excellently :) Here are the steps I followed to get it work within 5 minutes.

1- Install BartyCrouch. See the installation procedure from url.

2- Created a sample project, which you can access here. In that project created 2 labels ("Text Included" & "Text Excluded #bc-ignore!").

3- Add RunScript (instructions on how to add a build script here)

if which bartycrouch > /dev/null; then
    bartycrouch update -x
    bartycrouch lint -x
else
    echo "warning: BartyCrouch not installed, download it from https://github.com/Flinesoft/BartyCrouch"
fi

enter image description here

4- After building the project the Main.strings file excluded one label.Here are the screenshots showing the storyboard file & .strings file. enter image description hereenter image description here

Ulphi answered 22/6, 2016 at 10:8 Comment(0)
P
0

Check out ReMafoX, it's a Mac app that perfectly solves your problem. It can be easily installed and integrated within your project, watch this video for a detailed walkthrough.

To ignore specific Strings, simply add one of the customizable ignore flags from the "Interface Builder" pane in the "Comment for Localizer" field in your Storyboard/XIB files and the build-script you configured following the above linked video will exclude it on next build of your project (or press of the "Update" button in the config).

Config Option, Interface Builder pane

Postulate answered 11/10, 2022 at 23:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.