File tree 9 files changed +74
-94
lines changed
9 files changed +74
-94
lines changed Original file line number Diff line number Diff line change
1
+ ISP uses some third-party code.
2
+
3
+
4
+ locale-utils adapted from ember-i18n internals code
5
+ ====================================================
6
+ ## Copyright and license
7
+
8
+ Copyright 2011 James A. Rosen
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
11
+ You may obtain a copy of the License at
12
+
13
+ http://www.apache.org/licenses/LICENSE-2.0
14
+
15
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
16
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
17
+ specific language governing permissions and limitations under the License.
Original file line number Diff line number Diff line change 3
3
// for a locale or define behavior for a locale that Ember-I18n
4
4
// doesn't know about.
5
5
export default {
6
- // rtl: [true|FALSE] ,
7
- //
8
- // pluralForm: function(count) {
9
- // if (count === 0) { return 'zero'; }
10
- // if (count === 1) { return 'one'; }
11
- // if (count === 2) { return 'two'; }
12
- // if (count < 5) { return 'few'; }
13
- // if (count >= 5) { return 'many'; }
14
- // return 'other';
15
- // }
6
+ rtl : false ,
7
+
8
+ pluralForm : function ( count ) {
9
+ if ( count === 0 ) { return 'zero' ; }
10
+ if ( count === 1 ) { return 'one' ; }
11
+ if ( count === 2 ) { return 'two' ; }
12
+ if ( count < 5 ) { return 'few' ; }
13
+ if ( count >= 5 ) { return 'many' ; }
14
+ return 'other' ;
15
+ }
16
16
} ;
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 3
3
// for a locale or define behavior for a locale that Ember-I18n
4
4
// doesn't know about.
5
5
export default {
6
- // rtl: [true|FALSE] ,
7
- //
8
- // pluralForm: function(count) {
9
- // if (count === 0) { return 'zero'; }
10
- // if (count === 1) { return 'one'; }
11
- // if (count === 2) { return 'two'; }
12
- // if (count < 5) { return 'few'; }
13
- // if (count >= 5) { return 'many'; }
14
- // return 'other';
15
- // }
6
+ rtl : false ,
7
+
8
+ pluralForm : function ( count ) {
9
+ if ( count === 0 ) { return 'zero' ; }
10
+ if ( count === 1 ) { return 'one' ; }
11
+ if ( count === 2 ) { return 'two' ; }
12
+ if ( count < 5 ) { return 'few' ; }
13
+ if ( count >= 5 ) { return 'many' ; }
14
+ return 'other' ;
15
+ }
16
16
} ;
Original file line number Diff line number Diff line change 3
3
// for a locale or define behavior for a locale that Ember-I18n
4
4
// doesn't know about.
5
5
export default {
6
- // rtl: [true|FALSE] ,
7
- //
8
- // pluralForm: function(count) {
9
- // if (count === 0) { return 'zero'; }
10
- // if (count === 1) { return 'one'; }
11
- // if (count === 2) { return 'two'; }
12
- // if (count < 5) { return 'few'; }
13
- // if (count >= 5) { return 'many'; }
14
- // return 'other';
15
- // }
6
+ rtl : false ,
7
+
8
+ pluralForm : function ( count ) {
9
+ if ( count === 0 ) { return 'zero' ; }
10
+ if ( count === 1 ) { return 'one' ; }
11
+ if ( count === 2 ) { return 'two' ; }
12
+ if ( count < 5 ) { return 'few' ; }
13
+ if ( count >= 5 ) { return 'many' ; }
14
+ return 'other' ;
15
+ }
16
16
} ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Utilities for working with ember-i18n locales
3
+ *
4
+ * Pulled from ember-i18n internals, which do not expose these functions directly
5
+ *
6
+ */
7
+
8
+
9
+ // Walk up configuration objects from most specific to least.
10
+ function walkConfigs ( id , owner ) {
11
+ const appConfig = owner . _lookupFactory ( `locale:${ id } /config` ) ;
12
+ if ( appConfig ) { return appConfig ; }
13
+
14
+ const addonConfig = owner . _lookupFactory ( `ember-i18n@config:${ id } ` ) ;
15
+ if ( addonConfig ) { return addonConfig ; }
16
+
17
+ const parentId = parentLocale ( id ) ;
18
+ if ( parentId ) { return walkConfigs ( parentId , owner ) ; }
19
+ }
20
+
21
+ function parentLocale ( id ) {
22
+ const lastDash = id . lastIndexOf ( '-' ) ;
23
+ return lastDash > 0 ? id . substr ( 0 , lastDash ) : null ;
24
+ }
25
+
26
+
27
+ export { walkConfigs } ;
You can’t perform that action at this time.
0 commit comments