Marko
Marko

Reputation: 95

How to update localizable.strings from app by code?

I want to be able to update localized strings by code from the app. What I actually want to do is to make changes to the localization on a server and then let the iPhone application fetch updated localization strings from a server and then save them to the localizable.strings file.

Upvotes: 3

Views: 2444

Answers (3)

petteri
petteri

Reputation: 354

There's service (Get Localization) that allows you to upload those .strings files to server and fetch them via API. However there's no client for iPhone yet but it would be quite simple to do. You can contribute one or then wait that there's official available.

Upvotes: 0

Ole Begemann
Ole Begemann

Reputation: 135548

You won't be able to modify the Localizable.strings file in your app bundle because the app bundle is read-only on iOS devices. To grab localized strings from a strings file in your app's Library directory, you could programmatically create a bundle at that location, put a Localizable.strings file in it and then grab the localized strings with NSLocalizedStringFromTableInBundle(). (I haven't tried this but it should work.)

Upvotes: 1

VdesmedT
VdesmedT

Reputation: 9113

You can't ! Those files are part of the bundle and can't be updated. You will have to setup the whole translation framework by yourself (which is not that much work) and implement caching using either core data or serialized dictionaries (one for each language I suppose).

Upvotes: 3

Related Questions