2

I'm coding with extjs 4. I want to provide two language buttons for the French language and English language. I have googled the problem, but I didn't find a solution. I hope I will find a solution here.

Darin Kolev
  • 3,401
  • 13
  • 31
  • 46
Aminesrine
  • 2,082
  • 6
  • 35
  • 64

3 Answers3

1

Sencha introduced the following approach:

Keep translatable-text in separate configs:

Ext.define('MyForm',
    extend: 'Ext.form.Panel',

    // the next config is translatable
    submitBtnText: 'Submit',

    // ...

Create another js file which overrides locale configs and include it (js file) in html page:

// MyForm-fr.js
Ext.define('MyFormFr', {
    override: 'MyForm',
    submitBtnText: 'soumettre'
});

Take a look at Sencha's official example.

Molecular Man
  • 22,277
  • 3
  • 72
  • 89
1

You can place your translations (for example as overrides) in different files and load them according to the language. You can see an example here: http://docs.sencha.com/ext-js/4-0/#!/example/locale/multi-lang.html

Darin Kolev
  • 3,401
  • 13
  • 31
  • 46
0

I have token a look at the Sencha's official example, but now I want to add the translation to my application. In the example that I have followed the files.js and the file.html are in the same directory, but my application follows the MVC architecture, so it differs. I have a js file that contains words to translate:

if (Ext.app.ContactForm) {
Ext.apply(Ext.app.ContactForm.prototype, {
    formTitle: 'Contact Informatie (Dutch)',
    firstName: 'Nom',
    lastName: 'Prénom'
});

} And my application contains just one file.html, so I don't know where to put the file.js, in the same directory of the file.html or in the view folder! And how it can be readable bye all the application

Aminesrine
  • 2,082
  • 6
  • 35
  • 64