views:

79

answers:

1

Hi there,

I'd like to know if it is possible to "distribute" the translation resources (my "Localizable.strings" files) in many subfiles.

Indeed, in my application, I store text articles in many folders, and I'd like to put the translations of each articles just aside the original article, that means in its own folder.

To summarize, I'd like to use this kind of hierarchy :

Resources/
- Articles/
-- First_Article/
--- Content.article
--- Localizable.strings/
---- en
---- fr
-- Second_Article/
--- Content.article
--- Localizable.strings/
---- en
---- fr

Would anyone have an idea about the feasibility and how to achieve to do this ? :)

Thanks by advance

+1  A: 

You can do this by using the following:

 NSLocalizedStringFromTable(self,@"second_article",@"");

You should however not use the name Localizable.strings twice. Instead do the following:

- second_article.strings/
-- en
-- fr
Felix
It sounds like a great solution !Do you know if it's possible to read it from a URL, which could authorize to use a _real_ hierarchy in my application (I mean concrete folders in my app bundle) ?
Taku
You can't store things in your AppBundle after having built it in XCode. So you can't download files into it. You might be able to get this method to work with the documents folder: NSLocalizedStringFromTableInBundle. However it is probably best to simply download different resources from the server, depending on the language of the user. You can store a url pattern or post/prefix in the localizable.strings that directs users to the correct download path.
Felix
There might be more benefits with such solution, you're right.Thanks a lot for your help Felix :)
Taku