2012-04-30 13 views
6

मैं अपने आवेदन का अनुवाद करने की कोशिश कर रहा हूं और मुझे आधे प्लेसहोल्डर होने पर अनुवाद करना मुश्किल लगता है। तब मैं कोड का टुकड़ा संपादितप्लेसहोल्डर और NSLocalizedString

"festaCompresa" = @"%@ is the %i/%i/%i. the day of the week is %@. The holidays is included in the calculation. \n"; 

:

[textView1 insertText:[NSString stringWithFormat:NSLocalizedString(@"festaCompresaW, @""), nomeFesta, giornoFesta, meseFesta, annoFestaModificato, ggSett]]; 

यह

[textView1 insertText:[NSString stringWithFormat:@"%@ è il %i/%i/%i. Il giorno delle settimana è %@. La Festa è compresa nel calcolo. \n", nomeFesta, giornoFesta, meseFesta, annoFestaModificato, ggSett]]; 

मैं फ़ाइल localizable.string में डाल (English): मैं निम्नलिखित कोड का पता लगाने की जरूरत है काम नहीं करता।

+0

कैसे क्या यह काम नहीं करता है? – hamstergene

+0

स्क्रीन डिस्प्ले सही नहीं है क्योंकि शब्द की तुलना करें: festaCompresaW – Andrea

+0

फ़ाइल में त्रुटि भी है। स्ट्रिंग: प्रमाणीकरण विफल: डेटा को पढ़ा नहीं जा सका क्योंकि यह दूषित हो गया है। – Andrea

उत्तर

4

क्या आपने कोड कॉपी किया है? या आपने इसे फिर से टाइप किया था? यदि आप इसे कॉपी-पेस्ट किया क्योंकि समस्या है:

[textView1 insertText:[NSString stringWithFormat:NSLocalizedString(@"festaCompresaW, @""), nomeFesta, giornoFesta, meseFesta, annoFestaModificato, ggSett]]; 

मैं इसे

[textView1 insertText:[NSString stringWithFormat:NSLocalizedString(@"festaCompresa", @""), nomeFesta, giornoFesta, meseFesta, annoFestaModificato, ggSett]]; 

तो मूल रूप से एक "W के बजाय होना चाहिए लगता है।

इसके अलावा, Localizable.strings में आप उद्धरण के सामने @ डाल नहीं है, इसलिए इस:

"festaCompresa" = @"%@ is the %i/%i/%i. the day of the week is %@. The holidays is included in the calculation. \n"; 

होना चाहिए इस:

"festaCompresa" = "%@ is the %i/%i/%i. the day of the week is %@. The holidays is included in the calculation. \n"; 

आशा है कि यह मदद करता है

6

आपका तार फ़ाइल एक छोटी सी त्रुटि, आप एक @ जैसे कि एक NSString निरंतर रूप में स्ट्रिंग को शामिल किया है गया है - फ़ाइल स्वरूप तार उद्धरण में उपयोग करता है:

"festaCompresa" = "%@ is the %i/%i/%i. the day of the week is %@. The holidays is included in the calculation. \n"; 

Btw: जब स्थानीयकरण के लिए प्रारूप तार बनाने आपको स्थिति प्रारूपों का उपयोग करने की आवश्यकता हो सकती है, जहां प्रत्येक प्रारूप विनिर्देश में तर्क की संख्या शामिल होती है। उदाहरण के लिए:

"festaCompresa" = "%[email protected] is the %2$i/%3$i/%4$i. the day of the week is %@. The holidays is included in the calculation. \n"; 

यह उपर्युक्त स्ट्रिंग में स्पष्ट रूप से आवश्यक नहीं है क्योंकि तर्क प्रदान किए गए क्रम में शामिल हैं। हालांकि कुछ भाषाओं में उन्हें एक अलग क्रम में होना पड़ सकता है और इस तरह यह किया जाता है।

संबंधित मुद्दे