SOURCE CODE: Uize.Loc.Plurals.Langs.ro

VIEW REFERENCE

/*______________
|       ______  |   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.ro 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.ro= module implements a .

    *DEVELOPERS:* `Chris van Rensburg`

    Plural Categories
      ........................................................
      << table >>

      title: Plural Categories
      data:
      :| Category | Rule |
      :| one | i = 1 and v = 0 @integer 1 |
      :| few | v != 0 or n = 0 or n != 1 and n % 100 = 1..19 @integer 0, 2~16, 101, 1001, … @decimal 0.0~1.5, 10.0, 100.0, 1000.0, 10000.0, 100000.0, 1000000.0, … |
      :| other |  @integer 20~35, 100, 1000, 10000, 100000, 1000000, … |
      ........................................................
*/

Uize.module ({
  name:'Uize.Loc.Plurals.Langs.ro',
  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 i == 1 && v == 0 ? 'one' : v != 0 || n == 0 || n != 1 && within (n % 100,[[1,19]]) ? 'few' : 'other';
          }
        );
      }
    });
  }
});