1. #1
    Touch Premium Member hotdp's Avatar
    Join Date
    Nov 2010
    Location
    Denmark
    Posts
    603
    Vote Rating
    14
    hotdp will become famous soon enough

      0  

    Question Different languages/Translations

    Different languages/Translations


    Hi,
    The application I am developing for my work should be in 12 different languages.
    So every button, tabbutton..... Has its own "text" depending on the language selected on the first view.


    How do I solve this in the designer?

  2. #2
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,905
    Vote Rating
    62
    Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice

      0  

    Default


    We plan to add multi lang support further in the road map. We don't support it directly as of yet
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

  3. #3
    Touch Premium Member hotdp's Avatar
    Join Date
    Nov 2010
    Location
    Denmark
    Posts
    603
    Vote Rating
    14
    hotdp will become famous soon enough

      0  

    Default


    Quote Originally Posted by Phil.Strong View Post
    We plan to add multi lang support further in the road map. We don't support it directly as of yet
    Sounds good. But we have a lot of customers with the need for languages. So I need temp solution.

    Any good advise? I did it in ST1 by having a object for every language, like danish.hello world give "hej".

    But I don't see how I could set a text property to something else then a String in the Designer?

  4. #4
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,905
    Vote Rating
    62
    Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice

      0  

    Default


    Would have to be done after the fact outside of designer. You could use Designer to do it in one language and then use favorite text editor and find/replace tactics to replace the strings with objects
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

  5. #5
    Touch Premium Member hotdp's Avatar
    Join Date
    Nov 2010
    Location
    Denmark
    Posts
    603
    Vote Rating
    14
    hotdp will become famous soon enough

      0  

    Default


    Quote Originally Posted by Phil.Strong View Post
    Would have to be done after the fact outside of designer. You could use Designer to do it in one language and then use favorite text editor and find/replace tactics to replace the strings with objects
    I have to change the language inside the application. So the first view is a language selector and the language in the whole application should be the selected one.

    My deadline is soon so I have to figure this out. If no one has any sugestions I might post my solution here. Language selection will be essential for many of our apps.

  6. #6
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,266
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    Quote Originally Posted by hotdp View Post
    I have to change the language inside the application. So the first view is a language selector and the language in the whole application should be the selected one.

    My deadline is soon so I have to figure this out. If no one has any sugestions I might post my solution here. Language selection will be essential for many of our apps.
    Mmmmm...

    I been thinking on such issue and the only solution you have is to write some sort of interceptor on constructor and/or initComponent() which read language resource, traverse the DOM tree and replace properties (label, title, etc.) of already instantiated views.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  7. #7
    Touch Premium Member
    Join Date
    Sep 2011
    Posts
    69
    Vote Rating
    2
    pdm is on a distinguished road

      0  

    Default


    We need to be able to offer users customisable literals for everything.

    So what we've done so far is to define a function in launch() like window.myapp.t() which takes a string argument and returns the corresponding string from an associative array defined in a localisation js file included earlier. So every time you need a literal (eg a label) you put myapp.t('thisform.thislabel')

    I'd be interested to hear better suggestions and look forward to Sencha fully supporting translations.

  8. #8
    Touch Premium Member hotdp's Avatar
    Join Date
    Nov 2010
    Location
    Denmark
    Posts
    603
    Vote Rating
    14
    hotdp will become famous soon enough

      0  

    Default


    Quote Originally Posted by pdm View Post
    We need to be able to offer users customisable literals for everything.

    So what we've done so far is to define a function in launch() like window.myapp.t() which takes a string argument and returns the corresponding string from an associative array defined in a localisation js file included earlier. So every time you need a literal (eg a label) you put myapp.t('thisform.thislabel')

    I'd be interested to hear better suggestions and look forward to Sencha fully supporting translations.
    Can you do this in the Designer? I can only set text as Strings and not a function/object.

  9. #9
    Sencha - Architect Dev Team Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,905
    Vote Rating
    62
    Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice Phil.Strong is just really nice

      0  

    Default


    No you can't do this in Designer.

    you could do something clever like set all the components you need localized to a special cls like localizeMe and a 2nd cls to $localizeIndex.

    then you could have a script that traverses the dom on application launch looking for all components that have .localizeMe and you could use the $whatever to lookup the correct text depending on localization. Include a different resource file depending on language.

    ...?
    Phil Strong
    @philstrong
    #SenchaArchitect
    Sencha Architect Development Team

  10. #10
    Touch Premium Member hotdp's Avatar
    Join Date
    Nov 2010
    Location
    Denmark
    Posts
    603
    Vote Rating
    14
    hotdp will become famous soon enough

      0  

    Default


    Hi,
    Its going great with this feature. I just have one problem, Navigation View Title.
    I would like to change the title on the toolbar title. But if i change config.title = foo; It will not be visible.
    There is not set and get. What can i do?