Browse Source

Create a NUM2_THOUSANDS_VAR_BITS define.

master
Reece H. Dunn 5 years ago
parent
commit
915d51512a
2 changed files with 14 additions and 11 deletions
  1. 6
    6
      src/libespeak-ng/numbers.c
  2. 8
    5
      src/libespeak-ng/translate.h

+ 6
- 6
src/libespeak-ng/numbers.c View File

@@ -1149,27 +1149,27 @@ static const char *M_Variant(int value)
if (((value % 100) > 10) && ((value % 100) < 20))
teens = true;

switch ((translator->langopts.numbers2 >> 6) & 0x7)
switch (translator->langopts.numbers2 & NUM2_THOUSANDS_VAR_BITS)
{
case 1: // lang=ru use singular for xx1 except for x11
case NUM2_THOUSANDS_VAR1: // lang=ru use singular for xx1 except for x11
if ((teens == false) && ((value % 10) == 1))
return "1M";
break;
case 2: // lang=cs,sk
case NUM2_THOUSANDS_VAR2: // lang=cs,sk
if ((value >= 2) && (value <= 4))
return "0MA";
break;
case 3: // lang=pl
case NUM2_THOUSANDS_VAR3: // lang=pl
if ((teens == false) && (((value % 10) >= 2) && ((value % 10) <= 4)))
return "0MA";
break;
case 4: // lang=lt
case NUM2_THOUSANDS_VAR4: // lang=lt
if ((teens == true) || ((value % 10) == 0))
return "0MB";
if ((value % 10) == 1)
return "0MA";
break;
case 5: // lang=bs,hr,sr
case NUM2_THOUSANDS_VAR5: // lang=bs,hr,sr
if (teens == false) {
if ((value % 10) == 1)
return "1M";

+ 8
- 5
src/libespeak-ng/translate.h View File

@@ -475,11 +475,7 @@ typedef struct {

int numbers;

#define NUM2_THOUSANDS_VAR1 0x00000040
#define NUM2_THOUSANDS_VAR2 0x00000080
#define NUM2_THOUSANDS_VAR3 0x000000c0
#define NUM2_THOUSANDS_VAR4 0x00000100
#define NUM2_THOUSANDS_VAR5 0x00000140
#define NUM2_THOUSANDS_VAR_BITS 0x000001c0
#define NUM2_SWAP_THOUSANDS 0x00000200
#define NUM2_ORDINAL_NO_AND 0x00000800
#define NUM2_MULTIPLE_ORDINAL 0x00001000
@@ -491,6 +487,13 @@ typedef struct {
#define NUM2_ORDINAL_AND_THOUSANDS 0x00040000
#define NUM2_ORDINAL_DROP_VOWEL 0x00080000 // currently only for tens and units
#define NUM2_ZERO_TENS 0x00100000

#define NUM2_THOUSANDS_VAR1 0x00000040
#define NUM2_THOUSANDS_VAR2 0x00000080
#define NUM2_THOUSANDS_VAR3 0x000000c0
#define NUM2_THOUSANDS_VAR4 0x00000100
#define NUM2_THOUSANDS_VAR5 0x00000140

// bits 1-4 use variant form of numbers before thousands,millions,etc.
// bits 6-8 use different forms of thousand, million, etc (M MA MB)
// bit9=(LANG=rw) say "thousand" and "million" before its number, not after

Loading…
Cancel
Save