Possible bug with Textview multiline localization

Discuss GUI programming with the RapaGUI plugin here
Post Reply
User avatar
mrupp
Posts: 147
Joined: Sun Jan 31, 2021 7:44 pm
Location: Switzerland
Contact:

Possible bug with Textview multiline localization

Post by mrupp »

Hi there

I think I found a bug concerning the localization of a Textview that contains multiline text.
Please have a look at the following example:

Code: Select all

@REQUIRE "RapaGUI", {Link = True}
@APPTITLE "Localization-Test"

moai.CreateApp([[<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
	<window id="mainWindow" width="300" height="200" title="Localization-Test">
		<vgroup>
			<textview>
				This textview has more\nthan one line\nand has no i18n attribute set.
			</textview>
			<textview i18n="0">
				This textview has more\nthan one line\nand has the i18n attribute set.
			</textview>
		</vgroup>
	</window>
</application>]])

Repeat
	 WaitEvent
Forever
Image

Note: I left out the @CATALOG preprocessor on purpose for it's not needed to demonstrate the bug.

If there's a catalog file that contains the translated text, everything works fine, and \n is treated correctly as linebreaks.
But if there's no catalog file and the default text is used instead, \n is actually rendered as \n and not as linebreaks. As demonstrated in the example, this only happens if the i18n attribute is present.

This happens on Windows as well as with MUI, so it seems not to be wxWidget or MUI related.

Cheers, Michael
plouf
Posts: 462
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Possible bug with Textview multiline localization

Post by plouf »

my mistake..
Christos
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Possible bug with Textview multiline localization

Post by airsoftsoftwair »

Code: Select all

- Fix: Escape sequences like \n and \t weren't converted to the correct character code when the MOAI.I18N attribute was set
Post Reply