/*______________ | ______ | 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.lv 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.lv= module implements a . *DEVELOPERS:* `Chris van Rensburg` Plural Categories ........................................................ << table >> title: Plural Categories data: :| Category | Rule | :| zero | n % 10 = 0 or n % 100 = 11..19 or v = 2 and f % 100 = 11..19 @integer 0, 10~20, 30, 40, 50, 60, 100, 1000, 10000, 100000, 1000000, … @decimal 0.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, … | :| one | n % 10 = 1 and n % 100 != 11 or v = 2 and f % 10 = 1 and f % 100 != 11 or v != 2 and f % 10 = 1 @integer 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, … @decimal 0.1, 1.0, 1.1, 2.1, 3.1, 4.1, 5.1, 6.1, 7.1, 10.1, 100.1, 1000.1, … | :| other | @integer 2~9, 22~29, 102, 1002, … @decimal 0.2~0.9, 1.2~1.9, 10.2, 100.2, 1000.2, … | ........................................................ */ Uize.module ({ name:'Uize.Loc.Plurals.Langs.lv', 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 == 0 || within (n % 100,[[11,19]]) || v == 2 && within (f % 100,[[11,19]]) ? 'zero' : n % 10 == 1 && n % 100 != 11 || v == 2 && f % 10 == 1 && f % 100 != 11 || v != 2 && f % 10 == 1 ? 'one' : 'other'; } ); } }); } });