开发者

Localizing resources with xcode 4.0.2

开发者 https://www.devze.com 2023-03-02 23:55 出处:网络
I am having multiple issues trying to localize an app with xcode 4.0.2. This app was coded initially with previous version, but since I installed the 4.0.2 everything (more or less) has worked, excep

I am having multiple issues trying to localize an app with xcode 4.0.2. This app was coded initially with previous version, but since I installed the 4.0.2 everything (more or less) has worked, except localization. I have about 10 png's that load in 10 different xibs via UIImageView using Interface Builder. These png's are "correctly" localized, inside the es.lproj folder the spanish ones and in the en.lproj folder the english ones. The weird thing is that even inside xcode, when I open the xib file, it sometimes shows the english version and sometimes the spanish. ¿? The xibs are not localized, because there is nothing more to localize in there, just that UIImageView with the png's.

Is it n开发者_运维问答ot possible to localize just the png's?

Does anyone know if this issues respond to known bugs?

This png's are named text1.png, text2.png, text3.png ... Could it be something related to the serialized naming?


The default xib when there's no localization is english. When it load it pulls in the english resources. So you need to create the localized xibs in addition to the images. Or, what I'd recommend in your case since it's just 10 images, is to load and set the correct image in viewDidLoad. It'll be easier to maintain since you won't have to update every localized version of the xib for every change you make. Save that headache for when you have more items in one that are localized. :)


Well, I think that I get it...

  • I have changed the name to the png's. Instead of text1.png -> textone.png, texttwo.png ... (The name should not be a problem, though)
  • When changing the names, some of the png's has become red. Even though they were still in the right lang.lproj (ex. en.lproj) folder.
  • I have created another directory to back-up the files and cut-paste all the "red ones".
  • Then I have deleted (references and file) these files from xcode.
  • Using finder, I have pasted each one of these png's inside my main language file. Just to move it again to the xcode resources from there.
  • After having it in xcode again, I have localized it using the "Localization +" Inspector.
  • Then, using finder again, I have replaced new "localized" png inside lang.lproj (ex. es.lproj) with the old language png in the back-up folder.
  • Finally, I have deleted the app in the simulator, cleaned, and Run again.

I did the same process with xib files. And everything works now. I haven't found any way to fix dependencies or paths to files that aparently are ok, but the localization doesn't reach them as expected. I understand that this should not be the way, though.

0

精彩评论

暂无评论...
验证码 换一张
取 消