Support localization

raku currently has support for localization in eleven languages.

Please consider allowing access to use L10N::XX; so that exercises can be solved in any of these languages.

I imagine then that we would want as part of normalization a translation into a common/single reference language.

Further down the line it would also be good to offer automatic translations of code blocks into any of the supported human languages should a mentor or mentee indicate a language preference.

For a little more context see:

I have been considering doing this, but I haven’t yet figured out how the use L10N::XX line actually works, because when I attempt to run it with raku I get compilation errors as the non-english terms are unexpected.

I’ve had success taking the contents of a file and running it through the AST, but that would be cumbersome to set up.

Do you have an example module e.g. Leap.rakumod in a different language that can pass the tests on your local machine using the use L10N::XX line?

1 Like

No luck @m-dango

Leap.rakumod fails I think because it requires AST:

$ raku ~/rakudo/bin/raku ~/.raku/bin/prove6.raku Leap.rakumod ===SORRY!=== Error while compiling /home/SNIP/exercism/raku/leap/lib/Leap.rakumod
Can't use unknown trait 'is' -> 'uitvoer' in sub declaration.
use L10N::AF;

sub is-leap-year ( $jaar ) is uitvoer {

    so $jaar %% enige 400, alle 4, geen 100

}

The closest I can get to the issue is with:

$ RAKUDO_RAKUAST=1 raku ~/.raku/bin/prove6.raku Leap.rakumod 

Which then fails with:

===SORRY!===
No such method 'meta-object' for invocant of type
'RakuAST::Declaration::Import'

I get the more or less the same result with a Dutch translation of Leap:

use L10N::NL;

functie is-leap-year ( $jaar ) is export {

    dus $jaar %% elke 400, alle 4, geen 100

}

With the error:

$ raku ~/.raku/bin/prove6.raku Leap.NL.rakumod
===SORRY!===
Error while compiling Leap.NL.rakumod
Variable '$jaar' is not declared. Perhaps you forgot a 'sub' if this
was intended to be part of a signature?
at Leap.NL.rakumod:7
------> functie is-leap-year ( ⏏$jaar ) is export {
Leap.NL.rakumod .. Dubious, test returned 1
No subtests run                                                                                     

Test Summary Report
-------------------
Leap.NL.rakumod (Wstat: 256 Tests: 0 Failed: 0)
Non-zero exit status: 1                                                                                
  Parse errors: No plan found in TAP output                                                            
Files=1, Tests=0,  0 wallclock secs                                                                    
Result: FAILED

If we bring AST into the mix we can see more clearly the same error:

$ RAKUDO_RAKUAST=1 raku ~/rakudo/bin/raku ~/.raku/bin/prove6.raku Leap.NL.rakumod
===SORRY!===
No such method 'meta-object' for invocant of type
'RakuAST::Declaration::Import'