Page 5 of 6 FirstFirst ... 3456 LastLast
Results 41 to 50 of 60

Thread: Different languages/Translations

  1. #41
    Ext JS Premium Member devtig's Avatar
    Join Date
    Jan 2010
    Location
    Rotterdam, The Netherlands
    Posts
    420
    Vote Rating
    14
      2  

    Thumbs up

    I'm done. My improvements:
    • Allow for language change after language change after language change etc.
    • Go back to original language using initialConfig
    • Localizable grid values through column renderers!
    • When components need tooltips, I usually add them as a tip property to the same component. That tooltip can be translated as well.
    • Prevention against word wraps after translation that I have seen occuring.
    • upgrade to latest build of SA (442)
    • Use ExtJS from cdn.sencha.io
    • renamed locale file to js, because IIS for example can't read .json files by default. (just to make it easy to test run this)
    Most of my comments and changes are described in the commits and code. Code is mostly equal to what ssamayoa has posted.

    This is work in progress and needs further optimization. Specially in the area of configurability.

    Check it out, improve it and update it on Git . I will too. Thanks.

    https://github.com/devotis/Ext.ux.Localizer

  2. #42
    Sencha User thesilentman's Avatar
    Join Date
    Apr 2007
    Location
    Athens, Greece
    Posts
    232
    Vote Rating
    2
      0  

    Default

    Awesome!! As soon as I find a minute I'll check it out. Thanks!!

  3. #43
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,528
    Vote Rating
    353
      0  

    Default

    Excellent!

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 - 6
    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!

  4. #44
    Sencha User
    Join Date
    Dec 2012
    Location
    Spain
    Posts
    7
    Vote Rating
    1
      0  

    Default

    Hi, it's already been a little while since the last reply to this post but I'd like to share what I did in this regard (Localization) with my project.

    I started referring to all the localizable strings by a variable name:

    Code:
    var header = Ext.create( 'Ext.TitleBar', 
        { 
            id: 'header', docked: 'top', title: titleName, cls: '', html: htmlHeaderContent
        });
    And then I created a file for every language in the application with the translations:

    Code:
    //file eng_us.js
    var titleName="English title";
    var htmlHeaderContent="Html content in English";
    
    //file spa_es.js
    var titleName="Ttulo espaol";
    var htmlHeaderContent="Contenido en espaol";
    Then in the html file I can either check the language of the browser, or create a language selection screen, and decide which file to load.

    I find this way pretty easy to use and maintain.

  5. #45
    Sencha User Dumas's Avatar
    Join Date
    Dec 2008
    Location
    Vienna, Austria
    Posts
    589
    Vote Rating
    10
      0  

    Default

    Hello,

    the basic concept is quite good, but you are poluting the namespace by defining lots of global variables, this is not good. So I would recommend you the above posted solution using the Localizer.

    Best regards,
    Roland

  6. #46
    Ext JS Premium Member devtig's Avatar
    Join Date
    Jan 2010
    Location
    Rotterdam, The Netherlands
    Posts
    420
    Vote Rating
    14
      0  

    Default

    The namespace pollution alone is not a valid argument to use Localizer. He might as well use Ext.translations.titleName="Ttulo espaol";
    Christiaan Westerbeek @ Devotis
    Contact me for help with Ext JS, Node JS, FireBase, AngularJS and Javascript in general. Email me or find me at AirPair to connect.

  7. #47
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,528
    Vote Rating
    353
      0  

    Default

    Quote Originally Posted by devtig View Post
    The namespace pollution alone is not a valid argument to use Localizer. He might as well use Ext.translations.titleName="Ttulo espaol";
    Yep.

    But Localizer is meant to be use with existing applications and with applications crafted with Sencha Architect.

    Regards.
    UI: Sencha Architect 3.x / ExtJS 4 - 6
    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!

  8. #48
    Ext JS Premium Member devtig's Avatar
    Join Date
    Jan 2010
    Location
    Rotterdam, The Netherlands
    Posts
    420
    Vote Rating
    14
      0  

    Default

    Yes, I agree. I still use Localizer with projects I create with Sencha Architect today.
    Christiaan Westerbeek @ Devotis
    Contact me for help with Ext JS, Node JS, FireBase, AngularJS and Javascript in general. Email me or find me at AirPair to connect.

  9. #49
    Sencha User Dumas's Avatar
    Join Date
    Dec 2008
    Location
    Vienna, Austria
    Posts
    589
    Vote Rating
    10
      0  

    Default

    Yeah, this is true. I keept my explanation a little short. I didn't wanted to specifically recommend Ext.ux.Localizer, I wanted to recommend the concept of a localizer.

    I believe it's a more elegant way to have a text file which maps english strings to localized strings instead of using variables. This is a common an very successful pattern. You might want to look at gettext. There are many implementation of this in other languages, e.g. CakePHP has its implementation, and also JavaScript has multiple implementation, e.g. Jed.

    Since I'm using CakePHP as a backend I have my own implementation in Bancha. I have a shell task which collects all translatable strings and writes them all in a pot file (A catalog of all translatable strings, supported by a lot of fancy translation tools). When I then open my WebApp the localizer pulls the correct language translations, afterwards each call of Banacha.t('Hello %s, good to see you', name) will be translated and returns the localized version.

    Besides the advantage of having very readable code and having good tools to update and manage translations over time, I'm able to outsource specific translations.

    Best regards,
    Roland

  10. #50
    Sencha User Phil.Strong's Avatar
    Join Date
    Mar 2007
    Location
    Olney, MD
    Posts
    1,953
    Vote Rating
    65
      0  

    Default

    Sencha Architect 2.2 (coming soon) will include a new feature called process config.

    This allows you to integrate ideas like Localizer much more easily. More details to come from the author of this feature.
    Phil Strong
    @philstrong

Page 5 of 6 FirstFirst ... 3456 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •