Akbar
Akbar

Reputation: 1499

Can I localize the dynamically changing string/text in cocoa

I have understood the concept of internationalization a little in XCode4.The steps are

1.Add string file to the project

2.From the inspector panel of this string file,under localization sections,select the required localization languages from the list.

3.Consider I have added English and French.

4.If I want to localize the string Hello,I need to add key value pair in the relevant string Files like "Title" = "Hello" in Localizable.Sring(English) and "Title" = "Bonjour" in Localizable.Sring(French)

5.Then,We can read the localization text of English and French using NSLocalizedString(@"Title", nil);

This works fine.

Here is my requirement,I am reading a string from the Web services,I don't know the string and the length of the string,it might be a paragraph.It may be varying each time I send the request.

I need to read this text which is changing at runtime and covert to into required localized string lets consider French.How can I do this.Any suggestions would be appreciated.

Upvotes: 0

Views: 1021

Answers (1)

Daniel
Daniel

Reputation: 1057

I guess you know all possible strings. Why not using:

NSString *myDynamicString = ...
NSLocalizedString(myDynamicString, "dynamic string");

Upvotes: 1

Related Questions