The original strings in Android resources file had \n *and* the line-break, because it is not read in Android so it was just a redundancy. In Codename the line-break is read. replaceAll(myString, "\n", ""); worked. Thanks Il giorno martedì 18 agosto 2020 03:52:19 UTC+2, Shai Almog ha scritto: > > It's \n. If you see them it means that myString = > StringUtils.replaceAll(myString, "\\n", "\n"); will work. > > On Monday, August 17, 2020 at 8:34:50 PM UTC+3 P5music wrote: > >> I addition: I tried SpanLabel and text is multiline, but the "\n" are >> printed. Maybe this is a bug. >> TextArea displays nothing. >> >> >> Il giorno lunedì 17 agosto 2020 19:08:54 UTC+2, P5music ha scritto: >>> >>> I am using a special method to Localize strings. My app has keys and >>> some methods to handle them. >>> String resources are "in sync" with the Android project files, so I >>> would like to mantain the strings with the \n inside. >>> I have no problems to feed the Text area with a string with replaced >>> "\n". I do not know what I have to put in place of that escape char, or >>> other method to force line breaks. >>> Maybe I have to create a for loop to append strings? >>> Thanks in advance. >>> >>> Il giorno lunedì 17 agosto 2020 03:46:34 UTC+2, Shai Almog ha scritto: >>>> >>>> In the designer tool under the localization edit section you have a >>>> button at the bottom that allows you to edit multiline text. Just add the >>>> line breaks and the string will have them. >>>> >>>> SpanLabel and TextArea respect line breaks. >>>> >>>> TextArea doesn't implicitly fetch from the bundle though. For it you >>>> will need to use the UIManager.localize method. The logic is that you want >>>> to localize labels but text components include user input which isn't >>>> localized >>>> >>>> On Sunday, August 16, 2020 at 8:55:12 PM UTC+3 P5music wrote: >>>> >>>>> I want a screen in my app that display instructions. >>>>> I created the text and put it in a string. That string is in the >>>>> localization bundle. It has many escaped \n because its text is multiline >>>>> (it's the same string of the strings resources file in the original >>>>> Android >>>>> project of this iOS port). >>>>> I see that the escaped characters are written as they are, that is, I >>>>> see many \n in the text and it's not multiline as it is intended to be >>>>> read >>>>> by the user. >>>>> I used Label, TextView with same result.TextArea shows nothing. >>>>> Thanks in advance >>>>> >>>>
-- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/807869c4-164f-47c7-a1cf-955c1b581d19o%40googlegroups.com.
