문제

I've build an iOS application, and translated the application to English and Swedish. The problem I'm facing is that one word in English can have two different meaning (translations) in Swedish. So now I have the English word as the key and value. I want to be able to have one key, which I can call whatever I want and set the English value for it as well as the Swedish value, in this way I can translate it to Swedish with two different words and keeping the same word for English.

How can I achieve this guys? Thank you.

EDIT:

// this can be "Kommentar" or "Kommentera" in Swedish (2 different words)
NSLocalizedString(@"Comment", @"Comment") 

What I would like to have is:

NSLocalizedString(@"Comment_adj", @"Comment_adj") // En: Comment, Swe: Kommentar
NSLocalizedString(@"Comment_verb", @"Comment_verb") // En: Comment, Swe: Kommentera

Is it more clear now?

도움이 되었습니까?

해결책

The way to resolve this is to give your localized strings some context using NSLocalizedStringFromTable(<#key#>, <#tbl#>, <#comment#>).

For example:

NSLocalizedStringFromTable(@"Post", @"SubmitScreen", @"The button text for the post button on the submit screen");
NSLocalizedStringFromTable(@"Post", @"FenceDiagram", @"The label for the fence-post on the diagram of the fence"); 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top