Reputation: 2140
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.
Upvotes: 2
Views: 2025
Reputation: 2140
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
Upvotes: 0
Reputation: 22386
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.
Upvotes: 1
Reputation: 3409
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
Upvotes: 1