/*______________ | ______ | U I Z E J A V A S C R I P T F R A M E W O R K | / / | --------------------------------------------------- | / O / | MODULE : Uize.Loc.Plurals.Langs.be Package | / / / | | / / / /| | ONLINE : http://uize.com | /____/ /__/_| | COPYRIGHT : (c)2014 UIZE | /___ | LICENSE : Available under MIT License or GNU General Public License |_______________| http://uize.com/license.html */ /* Module Meta Data type: Package importance: 1 codeCompleteness: 100 docCompleteness: 100 */ /*? Introduction The =Uize.Loc.Plurals.Langs.be= module implements a . *DEVELOPERS:* `Chris van Rensburg` Plural Categories ........................................................ << table >> title: Plural Categories data: :| Category | Rule | :| one | n % 10 = 1 and n % 100 != 11 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, … @decimal 1.0, 21.0, 31.0, 41.0, 51.0, 61.0, 71.0, 81.0, 101.0, 1001.0, … | :| few | n % 10 = 2..4 and n % 100 != 12..14 @integer 2~4, 22~24, 32~34, 42~44, 52~54, 62, 102, 1002, … @decimal 2.0, 3.0, 4.0, 22.0, 23.0, 24.0, 32.0, 33.0, 102.0, 1002.0, … | :| many | n % 10 = 0 or n % 10 = 5..9 or n % 100 = 11..14 @integer 0, 5~19, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, … | :| other | @decimal 0.1~0.9, 1.1~1.7, 10.1, 100.1, 1000.1, … | ........................................................ */ Uize.module ({ name:'Uize.Loc.Plurals.Langs.be', required:'Uize.Loc.Plurals.Util', builder:function () { 'use strict'; return Uize.package ({ getPluralCategory:function (_value) { return Uize.Loc.Plurals.Util.getPluralCategory ( _value, function (n,i,f,t,v,w,within) { return n % 10 == 1 && n % 100 != 11 ? 'one' : within (n % 10,[[2,4]]) && within (n % 100,[[12,14]]) ? 'few' : n % 10 == 0 || within (n % 10,[[5,9]]) || within (n % 100,[[11,14]]) ? 'many' : 'other'; } ); } }); } });