Chinese translation doesn't work

Good morning,
I'm working with the translation, I can translate to English but not to Chinese.

This is the dropdown for the language change

This is the text that I'm trying to translate:

The translation should work in a simple button, the English is translated properly but when I translate from English to Chinese, the strange thing is that the word is translated to Italian.
It looks like the Chinese language is not supported..

Make sure you are wrapping your Chinese strings in unicode() or prefacing them with u'. Otherwise, they will not be rendered correctly.

Hi Justin,
you mean add the u' in the translation manager before the translation? For example u'转移? Because I try to do it and it's now working.

Anyway, what do you mean with wrapping in unicode()?

Unicode is just another way of doing the same thing.
Example: unicode('转移')

In Jython 2.7, unicode() is used to cast to a Unicode string as opposed to ASCII. In later versions of Python (starting from Python 3), all strings are Unicode by default, and str() can be used, but in Ignition Jython scripting, I've found that it's safer to perform string casts with unicode() instead of str() because otherwise, I run into issues with special characters.

You need to apologize me, but how can I insert the unicode() function in the translation manager? Because I would like to avoid to add a script for every component in the view, it should be crazy.

And thanks for the explanation!

No need for an apology, I was just being thorough when I offered both ways I know of for handling unicode characters in Ignition. I'm glad this worked for you:

Actually I try both the method in the translation manager but I can't make them work.

When I test this, it works for me, but the only thing I see that the translation manager doesn't like is that it sees the Chinese characters as lower case. You could try changing the ignore capitalization setting to see if it translates with that set to True:
image

Edit: I meant to say, it works for me without the need for any unicode handling.

At the moment I have all the settings set to "Ignore".

Do you set zh-CN as language code?

Yes. I used Chinese Simplified.

Very strange I really don't understand where is the error.. Later I will make some more test with a simple label.
Thanks again

Ok, I make it work in this way:
language Chinese Simplified
locale zh-Hans

I don't understand one thing.. I add this key:
italian Turno
english 'Shift'
chinese '转移'

I have this label with the text: Shift : and in this case the translator manager looks like it can't associate the text with the colon.

image

How can I fix this? I wouldn't add both Shift and Shift : in the translation manager, it should be a huge amount of work.

That's the difference; I didn't realize that there was space between the word and the colon when I tested it, so I was using Turno: and Shift: instead of Turno : and Shift :. When I went back and retested it with the space, I got the same result that you are reporting.

Italian--English--Chinese,maybe you have to add English translation, then add Chinese translation, that will take effect.

Ok, do you think is a bug? I mean in the "Settings" I set the option Ignore Whitespace, I guess this should be tehe case..

@taohongyu88, you mean use as primary language English and then choose Italian and Chinese as secondary?

Yeah! Must have English.

1 Like