Displaying Chinese chars - straight forward?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

KimD
Posts: 223
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Displaying Chinese chars - straight forward?

Post by KimD » Tue Feb 07, 2023 12:52 am

Hi

I'm scoping creating a Chinese language version of one of my apps. I saw a previous post on this topic, but it was nearly a decade old. I only need to display static object text in Chinese. I don't need to display user input fields in Chinese. My need is 99% for locked fields + buttons + data grid column headings. I would ultimately need to build standalones for Windows + Android + IOS. I had a quick play around using the IDE, and using Google translate to produce some sample Chinese char text. I found that for:

Locked fields - I can paste Chinese chars into Property Inspector > Contents, and it looks fine to me
Buttons - I can paste Chinese chars into Property Inspector > Label, and it looks fine to me
Data Grid, Column headers - I can paste Chinese chars into Property Inspector > Columns > Column label, and it looks fine to me

So, my first impressions are that it looks like it would be a somewhat time-consuming, but totally achievable and low technical risk, process to create a Chinese text version of my app. Am I being overly optimistic? Has anyone else had a negative experience trying to get LC to display static object text in Chinese?

Thanks

Kim

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Displaying Chinese chars - straight forward?

Post by richmond62 » Tue Feb 07, 2023 10:07 am

"Straight forward?"

Both Yes and No.

Before I start this explanation of how to do this sort of thing I would just like to point out that I do not speak
or read Chinese, so I hope I do not offend anyone with the choice of an inappropriate word.

The first place anyone wanting to work with a complex writing system and LiveCode needs to visit is here:

https://www.unicode.org/charts/

HOWEVER, I shall start by showing you how things can be done if:

1. You already know the written symbols you need.

2. You already have a way to enter those symbols into a computer.

To change the TITLE of a BUTTON simply copy-paste the symbols into the Preferences Palette of that BUTTON:
-
SShot 2023-02-07 at 11.06.36.png
-
You can do exactly the same thing in a FIELD:
-
SShot 2023-02-07 at 11.09.45.png
SShot 2023-02-07 at 11.09.45.png (24.42 KiB) Viewed 3162 times
Last edited by richmond62 on Tue Feb 07, 2023 11:01 am, edited 2 times in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Displaying Chinese chars - straight forward?

Post by richmond62 » Tue Feb 07, 2023 10:14 am

If, in the case of a BUTTON you are worried that it will look different on someone else's computer
you can take a SNAPSHOT of your button and get an IMAGE:
-
SShot 2023-02-07 at 11.12.38.png
-
You can delete your BUTTON and use the IMAGE in exactly the same was as a BUTTON
to guarantee it will look the same on every computer everywhere.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Displaying Chinese chars - straight forward?

Post by richmond62 » Tue Feb 07, 2023 10:27 am

Now [ and this is a bit more technical}, if you do NOT have a way of entering your symbols directly into your computer
you need to look up their UNICODE values in their relevant UNICODE chart:
-
SShot 2023-02-07 at 11.19.22.png
-
Then you can do this sort of thing:

[Be aware that the Unicode address is in Hexadecimal numbering, so you MUST prefix it with '0x']
-
SShot 2023-02-07 at 11.26.18.png
-
SShot 2023-02-07 at 11.26.28.png
Last edited by richmond62 on Tue Feb 07, 2023 10:52 am, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Displaying Chinese chars - straight forward?

Post by richmond62 » Tue Feb 07, 2023 10:32 am

If you want "the whole rabbit" you will have to do this:
-
SShot 2023-02-07 at 11.31.33.png
-
Please don't hesitate to ask further questions. 8)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Displaying Chinese chars - straight forward?

Post by richmond62 » Tue Feb 07, 2023 11:06 am

This is an amazingly fantastic webpage for looking up writing symbols:

http://shapecatcher.com/
-
SShot 2023-02-07 at 12.05.13.png
-

HOWEVER: "Japanese, Korean and Chinese characters are currently not supported."

Which is a great pity.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Displaying Chinese chars - straight forward?

Post by jacque » Tue Feb 07, 2023 7:32 pm

LC fully supports unicode and if pasting text into the inspectors works then I think you'll be fine. I'd make sure to view the app on different platforms and devices to be sure your fields and buttons allow for different text fonts and their spacing. I'd also make sure that someone fluent in Chinese proofreads the text for accuracy.

If you want to ensure consistency you can include a font in the app so it can be used regardless of the font's availability on the user's device.

What is the 1% that isn't static text?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

KimD
Posts: 223
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: Displaying Chinese chars - straight forward?

Post by KimD » Tue Feb 07, 2023 11:25 pm

Hi

Richmond - thanks for your very thorough response.
--- I'd rather avoid the unicode path, mostly because I wouldn't trust myself to correctly distinguish between Chinese characters that - to my untrained eye - look very similar to me.
--- I could go down the "save the char as an image" path, but it seems to me that this would be more work than if I can just find a way to get LC to reliably display Chinese char - and I think that it possibly already is.

Jacque - thanks for your succinct response.
--- The remaining 1% is Answer / Ask pop-ups.
--- Having Chinese char change the layout requirements of my app was an issue that had also occurred to me, but in the approx 10 test cases that I've done so-far the Chinese translations were more space efficient than the equivalent English text.
--- If I go ahead with this project then I'll get a professional to produce the Chinese text that I need.

Pasting Chinese text (produced by Google translate) into the inspectors works fine on the IDE, without needing to do any configuration or extra steps. I also just tried deploying my test app to a real Android device, and Chinese char displayed fine on that as well. So - with a sample size of two - support for Chinese char looks to me like this is a capability of out-of-the-box LC.

It had also occurred to me that adding a Chinese char font file to Standalone App Settings > Copy Files might reduce the risk associated with Chinese char not reliably displaying on different devices. One of the things that I don't currently understand is how the LC IDE is displaying Chinese char on the Windows 11 laptop that I use for development. Is there a Chinese char set built into all Windows 11 laptops, or is there a Chinese char set built into LC 9.6.9, or something else? The Property Inspector claims that the font of my Chinese char is Roboto. Roboto is the font that I use for the English version of my app, and I include the Roboto TFF in the standalones Copy Files. I've also tested changing font size in the IDE, and the Chinese char resize nicely.

It seems to me that I currently have 3 options:
1) Go with the Chinese char display capability that LC seems to offer out-of-the-box. My initial trials suggest that these work fine as-is.
2) Go with the Chinese char display capability that LC seems to offer out-of-the-box; plus add a Chinese font file (e.g., Noto) to the Copy Files. But I'm not sure that this is needed.
3) Go with images of Chinese translations. It's more work, but I can see that it would definitely remove device dependence issues.

Thanks

Kim

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Displaying Chinese chars - straight forward?

Post by jacque » Wed Feb 08, 2023 12:36 am

I'd go with "out of the box". Virtually all platforms have a Chinese font in their system, though it may vary. Roboto is native to Android so you're okay there, and apparently it's on Windows as well. I'm not so sure about iOS (or Mac) but you could include Roboto in the app, check the fontnames function, and if Roboto isn't there then start using the embedded one in the app.

I'm fairly confident you don't need to do too much to accomodate. The ask and answer dialogs should also work, but you'd need to test that since I've never tried it. You might need to set the textFont or the unicodeText of the dialog fields before they display. On the other hand, since dialogs inherit from the mainstack, maybe all you'd need to do is set the font of the mainstack to Roboto and it would just work.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Displaying Chinese chars - straight forward?

Post by richmond62 » Wed Feb 08, 2023 8:10 am

Mac comes with a whole set of Unicode compliant Chinese fonts installed.

According to Wikipedia the Roboto font does NOT support Chinese characters, and on Android they are supplied by the Noto font. This is something to be checked as Wikipedia is not always . . .

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Displaying Chinese chars - straight forward?

Post by richmond62 » Wed Feb 08, 2023 5:07 pm

Pasting Chinese text (produced by Google translate)
That is like taking your life in your hands.

Certainly my experience with various languages I speak is that Google translate is not very good, especially for
things you are expecting people to understand.

To just illustrate the point, a friend of mine from near Aberdeen is called 'Hew Wood' . . . now Google translate does NOT
see his name as a name but as a verb (Hew = to chop) followed by a noun (Wood = what trees are made of).
-
SShot 2023-02-08 at 18.02.05.png
-
SShot 2023-02-08 at 18.02.58.png
-
Similarly a Bulgarian type of air-dried sausage called Бански Старец gets made into this in Google translate:
-
SShot 2023-02-08 at 18.05.24.png
-
While these are all good fun to share with your pals, I would not
touch them with a 10-foot pole if it came to labelling some software.
Last edited by richmond62 on Mon Mar 06, 2023 4:59 pm, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Displaying Chinese chars - straight forward?

Post by richmond62 » Wed Feb 08, 2023 6:08 pm

Come to think of things, I'd put Google Trashlate right there in the naughty corner, right next to Wikipedia.

https://uncyclopedia.com/wiki/The_Art_of_Programming

https://uncyclopedia.com/wiki/Workaroun ... rogramming

far, far better and far, far more to the point than Wikipedia:

https://en.wikipedia.org/wiki/Kludge

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Displaying Chinese chars - straight forward?

Post by jacque » Wed Feb 08, 2023 6:31 pm

richmond62 wrote:
Wed Feb 08, 2023 8:10 am
According to Wikipedia the Roboto font does NOT support Chinese characters, and on Android they are supplied by the Noto font
In that case it seems LC recognizes Chinese and substitutes an appropriate language font. Setting the field font to "system" may be all that's necessary, which would allow LC to choose the native font on any OS.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9388
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Displaying Chinese chars - straight forward?

Post by richmond62 » Wed Feb 08, 2023 7:02 pm

I suspect it it is the underlying operating system that performs the font substitution:
-
SShot 2023-02-08 at 19.57.37.png
-
Charcoal [from Mac OS 9] is most definitely NOT a font that contains any Chinese symbols.

KimD
Posts: 223
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: Displaying Chinese chars - straight forward?

Post by KimD » Wed Feb 08, 2023 9:03 pm

Thanks Richmond and Jacque.

It does appear that LC has some out-of-the-box capability to display Chinese char, so that creating a Chinese version of my app should be "a bit of a slog", but not particularly technically challenging.

I don't yet know whether I'll proceed with this. It depends on what some other people decide. If I do then I'll comment on my experiences in a later reply to this post.

Kim

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”