Results 1 to 9 of 9

Thread: Multiple languages based on user's locale

  1. #1

    Default Multiple languages based on user's locale

    Hi,

    I would like my app to be localized and translated for several languages. So that the device loads the appropriate resources according to the locale settings of the device at run time. I don't care if the user has to restart the app to see the corresponding language of the chosen locale.

    How can I achieve this?
    Do I need to build one package per language?

    I found so many pages on the web that I'm confused now, so any help would be greatly appreciated.

    Thanks.

  2. #2

    Default

    Well, anybody?

  3. #3
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    4,108

    Default

    Are you using Sencha Touch or the ExtJS 6 modern toolkit?

  4. #4

    Default

    Thanks for your answer, I use sencha touch...

  5. #5

    Default

    Seriously? Nobody has ever done that? It seems to me that what I'm describing is the standard behavior for mobile apps...

  6. #6
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    4,108

    Default

    Unlike Ext there is not a locale package for sencha touch or modern applications.
    There is the following ux you should check out. Locales are implemented by overriding the text of the component classes you could also implement your own custom solution. Here's an example from Ext
    Code:
    Ext.define("Ext.locale.es.picker.Date", {
        override: "Ext.picker.Date",
        todayText: "Hoy",
        minText: "Esta fecha es anterior a la fecha mnima",
        maxText: "Esta fecha es posterior a la fecha mxima",
        disabledDaysText: "",
        disabledDatesText: "",
        nextText: 'Mes Siguiente (Control+Right)',
        prevText: 'Mes Anterior (Control+Left)',
        monthYearText: 'Seleccione un mes (Control+Up/Down para desplazar el ao)',
        todayTip: "{0} (Barra espaciadora)",
        format: "d/m/Y",
        startDay: 1
    });
    Last edited by fmoseley; 29 Sep 2015 at 11:15 AM. Reason: formatting
    Get more personalized support via a support subscription.

    Need more help with your app? Hire Sencha Services [email protected]

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

  7. #7

    Default

    I have a main label file in english (Utils.Labels) and several different other language files (Utils.Labels.es for spanish for example) that override Utils.Labels. What I am looking for is a way to override Utils.Labels based on user's locale when my app is starting. Is it possible?

  8. #8
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    4,108

    Default

    Yes it is possible. After loading the correct locale file you would have to reload your application so the changes would take effect. Like we do in the app.js onUpdated method with window.location.reload().

  9. #9

    Default

    Thanks for your answer. Where can I do window.location.reload() so that it doesn't create a loop?

Similar Threads

  1. extjs localization in multiple languages
    By vijaypatil12 in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 6 Jan 2018, 6:01 AM
  2. using multiple languages
    By wiwi in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 27 Jul 2012, 7:26 AM
  3. Multiple Languages
    By Angilo in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 6 Sep 2010, 7:40 AM
  4. using multiple languages in fieldLabels
    By rommirommi in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 2 Jun 2009, 5:23 AM

Tags for this Thread

Posting Permissions

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