سؤال

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