Github user rhtyd commented on the issue:

    https://github.com/apache/cloudstack/pull/1669
  
    CloudStack UI used dictionary, dictionary2 and index jsp files.
    
    The dictionary jsp files simply added a dictionary (java script object or 
map) by reading through messages properties for various translations. Replacing 
them was easy, we added a python script (`tools/transifex/gen-l10n.py`) that 
would generate js files (at build time) by reading through the `messages` files 
such that the generated dictionary (object or map) would be exactly same as 
what the jsp files did.
    
    The `index.jsp` file primarily did two things: (1) include dictionary, 
dictionary2 jsp files, (2) used them for translating strings. By replacing the 
dictionary jsp files with auto-generated translation js file based on a `lang` 
cookie exactly the same dictionary object was still accessible to the index.jsp 
file. All the translated strings in index.jsp were replaced with a new/custom 
`DOM` element `<translate key="some.key">`, and some code was added that would 
process and add text to this new dom element based on the translation key set. 
Replacement of `<fmt:` code with `<translate>` was done with a search/replace 
operation. By adding a new custom `DOM` element, no CSS changes were required. 
The translation was done by this method: 
https://github.com/shapeblue/cloudstack/blob/26b591f225abbee8690c20af914f8e37103043ef/ui/index.html#L1746
    
    The only exception were `select` dropdowns, where translation was done 
explicitly by getting the DOM element and injecting `options` as seen here:
    
https://github.com/shapeblue/cloudstack/blob/26b591f225abbee8690c20af914f8e37103043ef/ui/index.html#L1766


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to