문제

I have a localized application that uses two languages: English and German. I have images that are named based on the topic name, for example: I have a topic in my application that is named:Toys, and its corresponding image is:Toys.png. I have been loading the images for the topic by NSString *topicName.

Now the problem comes in the German version of the application. topicName variable is now in German, Spielzeuge, and of course the image is not loading, because there is no Spielzeuge.png in my bundle.

I know I could have duplicated my images to have both English and German versions and it would work, but is there a way to use the same images for both the languages without duplicating them?

Thanks!

도움이 되었습니까?

해결책

Add a property (e.g. imageName) to your topic class and use this for referencing the images. Then leave imageName in the localized strings file always be the english string.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top