Hybrid View

  1. #1
    Sencha User
    Join Date
    Dec 2009
    Location
    Tokyo
    Posts
    46
    Vote Rating
    0
    TigrouMeow is on a distinguished road

      0  

    Question Unanswered: MVC with dynamic loading and... i18n ?

    Unanswered: MVC with dynamic loading and... i18n ?


    I would like to translate my ExtJS application in different languages. My issue is that I'm using ExtJS MVC framework, and most of my JS files are downloaded dynamically by the framework itself.
    The ideal solution (that I thought of) would be to have an extra option in the Ext.Loader (or in my Ext.app.Application) that would define the language to use, and depending on this to automatically download such file as "a.MyClass.fr.js" after loading my "a.MyClass.js" (which would contain an Ext.apply, overriding my string resources). That's probably not available in the ExtJS framework at the moment.
    The alternative solution I can see, is to perform a trick on the server-side. First, a cookie would be created on the client, to set to the language. On the server-side, I could catch all the requests to JS files, then if a cookie is set (='fr' for example), I'd combine the requested JS file (MyClass.js) with its i18n's friend (MyClass.fr.js) dynamically on the server and return the result. That would work, but it's really tricky because it implies other things (caching...).
    Maybe the best way is to implement the first behavior I described in the ExtJS framework myself...
    What do you think? I'm looking for a really clean and neat way of doing it! Thanks

  2. #2
    Sencha User
    Join Date
    Aug 2009
    Posts
    11
    Vote Rating
    0
    vdan is on a distinguished road

      0  

    Default


    If you want to dynamically download a file, and assuming the loader is enabled, you could do:

    PHP Code:
    Ext.require('path/to/file'); 
    "Recommendation": When going into production, you would normally not download all the files of your app individually (see the getting started guide). But that is a side topic...

  3. #3
    Sencha User
    Join Date
    Dec 2009
    Location
    Tokyo
    Posts
    46
    Vote Rating
    0
    TigrouMeow is on a distinguished road

      0  

    Default


    It's actually a test environment, I can + enjoy to use dynamic loading, and it's pretty convenient within the MVC framework as well. So that would be another issue / question

    I could use Ext.require, but... with what? Where? I don't know when my file ("MyClass.js") is going to be loaded, and I need to apply my localization right after it (apply).

    It would be nice to have an "afterload" listener on the Ext.Loader: I could then have a handler on it, which would actually call Ext.require with my localized filename ("MyClass.fr.js").

    The hierarchy of folders within the MVC framework is quite strict and nice (controller / model / store / view...), but it would be nice to have a "i18n" folder that would be managed as well as the rest.

  4. #4
    Sencha User
    Join Date
    Aug 2009
    Posts
    11
    Vote Rating
    0
    vdan is on a distinguished road

      0  

    Default


    You may try to have a "require" directly in MyClass.js, so you are sure MyClass-lang.js is loaded when MyClass is loaded.

  5. #5
    Sencha User
    Join Date
    Dec 2009
    Location
    Tokyo
    Posts
    46
    Vote Rating
    0
    TigrouMeow is on a distinguished road

      0  

    Default


    Mmm, I would have to add those "require" on all my classes then, manually. I could maybe create a patch (Ext.apply) on the Ext.Component (right before to create my Application), so that the constructor will check if there are any "require" to perform. Wouldn't be too hard and too dirty, isn't it?

  6. #6
    Sencha User
    Join Date
    Aug 2009
    Posts
    11
    Vote Rating
    0
    vdan is on a distinguished road

      0  

    Default


    Then maybe have a look at this plugin.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi