File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,22 @@ app.factory('I18nService', function() {
5
5
var I18nService = function ( ) { } ;
6
6
7
7
I18nService . prototype . language = 'en' ;
8
+ I18nService . prototype . fallback = 'en' ;
8
9
I18nService . prototype . timeHumanizer = { } ;
9
10
10
- I18nService . prototype . init = function init ( lang ) {
11
+ I18nService . prototype . init = function init ( lang , fallback ) {
12
+ var supported_languages = humanizeDuration . getSupportedLanguages ( ) ;
13
+
14
+ this . fallback = ( fallback !== undefined ) ? fallback : 'en' ;
15
+ if ( supported_languages . indexOf ( fallback ) === - 1 ) {
16
+ this . fallback = 'en' ;
17
+ }
18
+
11
19
this . language = lang ;
20
+ if ( supported_languages . indexOf ( lang ) === - 1 ) {
21
+ this . language = this . fallback ;
22
+ }
23
+
12
24
//moment init
13
25
moment . locale ( this . language ) ; //@TODO maybe to remove, it should be handle by the user's application itself, and not inside the directive
14
26
You can’t perform that action at this time.
0 commit comments