Note that there are some explanatory texts on larger screens.

plurals
  1. POxcode 5 localize storyboard with script delete *.strings file?
    text
    copied!<p>sorry to make another bother. I'm implement an app, with localization of English and Japanese in xcode 5, using the script file created by André Pinto, based on <a href="http://forums.macrumors.com/showthread.php?t=1467446" rel="nofollow">SIngle Storyboard for multiple languages</a>. Well, before upgrade to xcode 5 (xcode 4.6, I mean), things work properly. But since xcode 5, this error occurs when run the script file:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;com.apple.ibtool.errors&lt;/key&gt; &lt;array&gt; &lt;dict&gt; &lt;key&gt;description&lt;/key&gt; &lt;string&gt;Interface Builder could not open the document "xx.storyboard" because it does not exist.&lt;/string&gt; &lt;/dict&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/plist&gt; Iconv: ./xx/Base.lproj/xx.strings.new: No such file or directory Rm: ./xx/Base.lproj/xx.strings.new: No such file or directory Merging xx.strings changes for en.lproj... Merging xx.strings changes for ja.lproj... Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure </code></pre> <p>In the storyboard, there are 2 sub-files: xx.storyboard(Base) and xx.storyboard(Japanese)</p> <p>In the first build, no error occur. Everything went fine. App localize so good. </p> <p>In the second build, I made somechange in storyboard (add some new feature), then error occur. Also, the xx.storyboard(Japanese) become blank, and this is weird. I put lots of effort translate those things, and now I have to do it again...</p> <p>I think there's some problem with the script, the strings.new and strings.old...</p> <p>Here's the script:</p> <pre><code>#!/bin/sh # Update storyboard string files # # by 2013 André Pinto andredsp@gmail.com # based on http://forums.macrumors.com/showthread.php?t=1467446 storyboardExt=".storyboard" stringsExt=".strings" newStringsExt=".strings.new" oldStringsExt=".strings.old" localeDirExt=".lproj" baselprojName="Base.lproj" # Find Base internationalization folders find . -name "$baselprojName" | while read baselprojPath do # Get Base project dir baselprojDir=$(dirname "$baselprojPath") # Find storyboard file full path inside base project folder find "$baselprojPath" -name "*$storyboardExt" | while read storyboardPath do # Get Base strings file full path baseStringsPath=$(echo "$storyboardPath" | sed "s/$storyboardExt/$stringsExt/") # Get storyboard file name and folder storyboardFile=$(basename "$storyboardPath") storyboardDir=$(dirname "$storyboardPath") # Create strings file only when storyboard file newer newer=$(find "$storyboardPath" -prune -newer "$baseStringsPath") [ -f "$baseStringsPath" -a -z "$newer" ] &amp;&amp; { echo "$storyboardFile file not modified." continue } # Get New Base strings file full path and strings file name newBaseStringsPath=$(echo "$storyboardPath" | sed "s/$storyboardExt/$newStringsExt/") stringsFile=$(basename "$baseStringsPath") echo "Creating default $stringsFile for $storyboardFile..." ibtool --export-strings-file "$newBaseStringsPath" "$storyboardPath" iconv -f UTF-16 -t UTF-8 "$newBaseStringsPath" &gt; "$baseStringsPath" rm "$newBaseStringsPath" # Get all locale strings folder with same parent as Base ls -d "$baselprojDir/"*"$localeDirExt" | while read localeStringsDir do # Skip Base strings folder [ "$localeStringsDir" = "$storyboardDir" ] &amp;&amp; continue localeDir=$(basename "$localeStringsDir") localeStringsPath="$localeStringsDir/$stringsFile" # Just copy base strings file on first time if [ ! -e "$localeStringsPath" ]; then echo "Copying default $stringsFile for $localeDir..." cp "$baseStringsPath" "$localeStringsPath" else echo "Merging $stringsFile changes for $localeDir..." oldLocaleStringsPath=$(echo "$localeStringsPath" | sed "s/$stringsExt/$oldStringsExt/") cp "$localeStringsPath" "$oldLocaleStringsPath" # Merge baseStringsPath to localeStringsPath awk ' NR == FNR &amp;&amp; /^\/\*/ { x=$0 getline a[x]=$0 next } /^\/\*/ { x=$0 print getline $0=a[x]?a[x]:$0 printf $0"\n\n" }' "$oldLocaleStringsPath" "$baseStringsPath" &gt; "$localeStringsPath" rm "$oldLocaleStringsPath" fi done done done </code></pre> <p>Localizable.strings and InfoPlist.strings are still good.</p> <p>Anyone has experience with this kind of things help me please... Is that something with xcode, or script file or xx.strings file? I don't get it...</p> <p>I may ask it directly the script's creator, but I think post the question here will be better. I'm a SO lover :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload