Fleker / Gltn

A powerful word processor built on the web
http://felkerdigitalmedia.com/gltn/
23 stars 5 forks source link

Localization - Switch to Stylesheets #135

Closed Fleker closed 1 year ago

Fleker commented 10 years ago

As it stands, it is easy to move from handlebars to span nodes. Each of these nodes carries the id of the localization string. As this happens at the node level, there are no HTML event breaks.

Ie. {{ Locale.FORMAT }} becomes <span class='Locale-FORMAT'>

Now, a jQuery function is called every time the locale is set. This function will set the text of each Locale-* class element. This works fine, but these functions must be repeatedly called to ensure that all text is up-to-date.

As the string then becomes a class, it can be modified automatically through CSS. Using a :before, the text can be displayed whenever it is available without needing to call excessive functions.

This can be done automatically through a function at the beginning, and added inline, while keeping the same JSON structure.