Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

No way to print a dollar sign ($)? #3

Closed
xSke opened this issue Feb 10, 2016 · 2 comments
Closed

No way to print a dollar sign ($)? #3

xSke opened this issue Feb 10, 2016 · 2 comments
Milestone

Comments

@xSke
Copy link

xSke commented Feb 10, 2016

If I try to put a $ literal in a label, it complains about action stuff. Escaping with a backslash doesn't seem to work either. I "fixed" it by setting a label's text to $ from Java every frame. It seems like it should be possible to escape it, no? HTML entities don't work either.

@czyzby
Copy link
Owner

czyzby commented Feb 12, 2016

Use a .properties file, put your special characters there. Then you can reference it like any other localized text. For example - in bundle file:
dol=$
In .lml file:
<label>@dol</label>

Bundle texts (proceeded with @) are preferred over plain text in templates anyway, so I don't think that it's much of an issue. Also, you can replace default characters by overriding DefaultLmlSyntax methods; if you don't use actions much, you can select another, more unusual character.

@czyzby
Copy link
Owner

czyzby commented Feb 13, 2016

For the record, LML 1.5.1.9.2 will allow using a single restricted character, as these cannot be properly parsed to property names, bundle lines or actions anyway. So - for example - it wouldn't throw any exceptions if you used $ sign as label.

Restricted characters cannot begin a string. For example, <label>hi$</label> would work just fine, while <label>$hi</label> would look for a method named hi, try to invoke it and put the result in its place. That's why there is no character escaping. If you need to begin a text value (longer than 1) with a restricted character, use i18n bundle.

@czyzby czyzby closed this as completed Feb 13, 2016
@czyzby czyzby added the lml label Apr 9, 2016
@czyzby czyzby added this to the 1.5 milestone Apr 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants