Page 1 of 1

Possible bug with Textview multiline localization

Posted: Mon Oct 04, 2021 8:41 pm
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

Re: Possible bug with Textview multiline localization

Posted: Mon Oct 04, 2021 8:57 pm
by plouf
my mistake..

Re: Possible bug with Textview multiline localization

Posted: Sat Oct 09, 2021 9:00 pm
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