iOS - info.plist 國際化斷行問題(目前無解)
iOS - info.plist 國際化斷行問題(目前無解)
先寫結論
info.plist 國際化斷行問題,目前無解。
說明
網路上只找得到 info.plist 國際化的作法為:添加 InfoPlist.strings 。
但目前發現使用 InfoPlist.strings,其英文斷行皆是以字母斷行,而且無法控制斷行位置(無解決方法)。
實際遇到的狀況
我在 StackOverflow 發了兩條問題,皆是以 InfoPlist.strings 國際化後遇到的問題,目前都無法找到完美解法:
-
在 viewWillAppear 中將 StoryBoard 的 UILabel 字串換成國際化字串後斷行錯誤
Word Wrap wrong when changing strings in viewWillAppear -
系統權限說明文字國際化斷行錯誤
System Alert wrong word wrap when using localization strings
對於第 1 條問題,原本的作法是在 viewWillAppear 中將 StoryBoard 的 UILabel、UIButton 等等填入 InfoPlist.strings 的變數字串即可,但它斷行會有問題。最後解法,就是將 StoryBoard 國際化,再把字串一個一個填到其相對應的 StoryBoard 字串中。
對於第 2 條問題,本來是以為將 Info.plist 進行國際化,誰知道一進行國際化後, XCode 自己就找不到 Info.plist 了!
後記
寫這篇文章只是先記錄著目前 XCode 有這個問題,待到 Apple 更新之後再來修改文章。