cbi18n
Search…
v2.x
Introduction
Intro
Release History
About this Book
Author
GETTING STARTED
Overview
Installation
Configuration
Usage
Coding for i18n
How do I change Locales?
Best Practices
Resources
Powered By
GitBook
How do I change Locales?
Well, it would not make any sense to use i18n for just one locale, would it? That is why you need to be able to change the application's locale programmatically. You can do this in two ways:
1.
Using the i18n mixin method
setfwLocale()
.
2.
Using the i18n service
setfwLocale()
.
Below you can see an example:
1
function
changeLocale
(
event
,
rc
,
prc
){
2
setFWLocale
(
rc
.
locale
);
3
relocate
(
'main.home'
);
4
}
Copied!
Or use via injection
1
component
{
2
3
property name
=
"i18n"
inject
=
"
[email protected]
"
;
4
5
function
changeLocale
(){
6
i18n
.
setFWLocale
(
'en_US'
);
7
}
8
9
}
Copied!
Previous
Custom Resource Services
Next - Usage
Best Practices
Last modified
1yr ago
Copy link
Edit on GitHub