SpellValue (String)

hey Dev’s

do you think it’s possible to implement the French language in the SpellValue (String) node in next release?

thx
charles

ei circuit,

problem is that none of us speaks french. below is the function spellvalue uses to convert numbers to english. if you can translate that to a similar function for frensh (and i am not sure if it is enough to translate the words here), we could certainly incorporate that.

{CODE(ln=>1)}
function ToEnglish(Number: integer): string;
const
Numbers: array1…19 of string = (‘one’, ‘two’, ‘three’, ‘four’,
‘five’, ‘six’, ‘seven’, ‘eight’, ‘nine’, ‘ten’, ‘eleven’, ‘twelve’,
‘thirteen’, ‘fourteen’, ‘fifteen’, ‘sixteen’, ‘seventeen’, ‘eighteen’,
‘nineteen’);
Tenths: array1…9 of string = (‘ten’, ‘twenty’, ‘thirty’, ‘forty’,
‘fifty’, ‘sixty’, ‘seventy’, ‘eighty’, ‘ninety’);

function RecurseNumber(N: integer): string;
begin
case N of
1…19:
Result := NumbersN;
20…99:
Result := Tenths[N div 10](N div 10) + ’ ’ + RecurseNumber(N mod 10);
100…999:
Result := Numbers[N div 100](N div 100) + ’ hundred ’ + RecurseNumber(N mod 100);
1000…999999:
Result := RecurseNumber(N div 1000) + ’ thousand ’ +
RecurseNumber(N mod 1000);
1000000…999999999:
Result := RecurseNumber(N div 1000000) + ’ million ’
+ RecurseNumber(N mod 1000000);
end;
end;

begin
result := ‘’;

if Number < 0 then
  begin
    result := 'minus ';
    number := abs(Number);
  end;

if Number > 999999999 then
  begin
    result := 'huuuge';
    exit;
  end;

if (Number = 0) then
  begin
    result := 'null';
    exit;
  end;

Result := Trim(result + RecurseNumber(Number));

end;
^

hey Joreg
i can do the translation
but there’s many specific rules in French :

http://www.leconjugueur.com/frlesnombresecrits.php

numbers from 11 to 16 (like eleven and twelve in english)
are not related to their units.

between 70 -> 79 and 90 -> 99: numbers are spelled like this
70 : sixty ten
71 : sixty and eleven
72 : sixty twelve

90 : eighty ten
91 : eighty eleven
92 : eighty twelve

another exception is as you can see a link word “et”
for the first numbers after a tenths

20 : vingt
21 : vingt et un
22 : vingt deux

true for all tenths+1 except for the 81 and the 91 numbers
what a a mess :)

nkay…

still hoping for a french who can code a little and put that mess in a function similar to the above…

37 . if Number > 999999999 then
38 . begin
39 . result := ‘huuuge’;
40 . exit;
41 . end;

Lol :)