cldr 7.4.0 → 7.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "type": "node",
9
+ "request": "launch",
10
+ "name": "Test suite",
11
+ "program": "${workspaceFolder}/node_modules/.bin/_mocha",
12
+ "args": ["--timeout", "9999999999"],
13
+ "skipFiles": [
14
+ "<node_internals>/**" // Prevent stepping through async_hooks.js et al.
15
+ ]
16
+ },
17
+ {
18
+ "type": "node",
19
+ "request": "launch",
20
+ "name": "Mocha current file",
21
+ "cwd": "${workspaceRoot}",
22
+ "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha",
23
+ "windows": {
24
+ "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha.cmd"
25
+ },
26
+ "runtimeArgs": [
27
+ "--timeout",
28
+ "999999",
29
+ "--colors",
30
+ "--recursive",
31
+ "${file}"
32
+ ],
33
+ "internalConsoleOptions": "openOnSessionStart"
34
+ }
35
+ ]
36
+ }
package/CHANGELOG.md CHANGED
@@ -1,10 +1,20 @@
1
+ ### v7.4.1 (2023-06-05)
2
+
3
+ - [Support more \[ ... \] variants in RBNF rules Fixes \#174](https://github.com/papandreou/node-cldr/commit/43a362a21ad3f43e02e75185db3bac532a457dbe) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
4
+ - [Add vscode debugger launch config](https://github.com/papandreou/node-cldr/commit/54352b8e8be09ee43a1225ecc05a19c35bcb2c06) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
5
+ - [replace depracated environment](https://github.com/papandreou/node-cldr/commit/25ba30271adce04d164868ca97a2e1dd70b4de6a) ([rotsee](mailto:leo_wallentin@hotmail.com))
6
+ - [syntax](https://github.com/papandreou/node-cldr/commit/2c6bbc4f027ec6f7a78319b2553200d8fd6feff9) ([rotsee](mailto:leo_wallentin@hotmail.com))
7
+
1
8
  ### v7.4.0 (2023-04-13)
2
9
 
3
- - CLDR upgraded to v43
10
+ #### Pull requests
4
11
 
5
- ### v7.3.0 (2022-11-11)
12
+ - [#172](https://github.com/papandreou/node-cldr/pull/172) ([rotsee](mailto:leo_wallentin@hotmail.com))
13
+
14
+ #### Commits to master
6
15
 
7
- - CLDR upgraded to v42
16
+ - [v7.4.0: CLDR 43](https://github.com/papandreou/node-cldr/commit/25efb35558c40d8bc523b591955c4091f90cfe2a) ([rotsee](mailto:leo_wallentin@hotmail.com))
17
+ - [Fix CHANGELOG generation in preversion script now that an npm env var changed](https://github.com/papandreou/node-cldr/commit/8dd6ee35193df27c4cd0f85912f7827a720cd258) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
8
18
 
9
19
  ### v7.2.0 (2022-04-24)
10
20
 
@@ -399,9 +399,62 @@ CldrRbnfRuleSet.prototype = {
399
399
  rbnf: optional,
400
400
  value: rule.value,
401
401
  });
402
- expressionAsts.push({
403
- type: 'ConditionalExpression',
404
- test: {
402
+ let testAst;
403
+ if (rule.value === '-x') {
404
+ throw new Error('[ ... ] not allowed in negative number rule');
405
+ } else if (rule.value === '0.x') {
406
+ throw new Error('[ ... ] not allowed in proper fraction rule');
407
+ } else if (rule.value === 'x.x') {
408
+ // in improper-fraction rule:
409
+ // Omit the optional text if the number is between 0 and 1 (same as specifying both an x.x rule and a 0.x rule)
410
+ testAst = {
411
+ type: 'BinaryExpression',
412
+ operator: '&&',
413
+ left: {
414
+ type: 'BinaryExpression',
415
+ operator: '>=',
416
+ left: {
417
+ type: 'Identifier',
418
+ name: 'n',
419
+ },
420
+ right: {
421
+ type: 'Literal',
422
+ value: 0,
423
+ },
424
+ },
425
+ right: {
426
+ type: 'BinaryExpression',
427
+ operator: '<=',
428
+ left: {
429
+ type: 'Identifier',
430
+ name: 'n',
431
+ },
432
+ right: {
433
+ type: 'Literal',
434
+ value: 1,
435
+ },
436
+ },
437
+ };
438
+ } else if (rule.value === 'x.0') {
439
+ // in default rule:
440
+ // Omit the optional text if the number is an integer (same as specifying both an x.x rule and an x.0 rule)
441
+ testAst = {
442
+ type: 'UnaryExpression',
443
+ operator: '!',
444
+ prefix: true,
445
+ argument: {
446
+ type: 'Identifier',
447
+ name: 'isFractional',
448
+ },
449
+ };
450
+ } else {
451
+ // TODO:
452
+ // in rule in fraction rule set:
453
+ // Omit the optional text if multiplying the number by the rule's base value yields 1.
454
+
455
+ // in normal rule:
456
+ // Omit the optional text if the number is an even multiple of the rule's divisor
457
+ testAst = {
405
458
  type: 'BinaryExpression',
406
459
  operator: '===',
407
460
  left: {
@@ -420,7 +473,12 @@ CldrRbnfRuleSet.prototype = {
420
473
  type: 'Literal',
421
474
  value: 0,
422
475
  },
423
- },
476
+ };
477
+ }
478
+
479
+ expressionAsts.push({
480
+ type: 'ConditionalExpression',
481
+ test: testAst,
424
482
  consequent: {
425
483
  type: 'Literal',
426
484
  value: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cldr",
3
- "version": "7.4.0",
3
+ "version": "7.4.1",
4
4
  "description": "Library for extracting data from CLDR (the Unicode Common Locale Data Repository)",
5
5
  "main": "lib/cldr.js",
6
6
  "scripts": {
@@ -271,4 +271,16 @@ describe('extractRbnfFunctionByType', () => {
271
271
  }
272
272
  });
273
273
  });
274
+
275
+ describe('with the Russian RBNF rules', function () {
276
+ // Regression test for https://github.com/papandreou/node-cldr/issues/174
277
+ it('should render a number', function () {
278
+ const renderers = cldr.extractRbnfFunctionByType('ru');
279
+ expect(
280
+ renderers.renderSpelloutCardinalMasculine(123),
281
+ 'to equal',
282
+ 'сто двадцать три'
283
+ );
284
+ });
285
+ });
274
286
  });