From 8b37f7ff2e5cc89806e20ac366ce9f09c3b29aa7 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Tue, 19 Dec 2023 17:37:03 +0100 Subject: [PATCH] First commit for L10N collection logic --- .github/workflows/test.yml | 31 ++ .gitignore | 2 + Changes | 4 + LICENSE | 201 +++++++++ META6.json | 33 ++ README.md | 34 +- dist.ini | 9 + lib/L10N.rakumod | 32 ++ localizations/CORE | 816 ------------------------------------- t/basic.rakutest | 79 ++++ t/sources/basic | 91 +++++ t/sources/basic.DE | 69 ++++ t/sources/basic.EN | 69 ++++ t/sources/basic.FR | 69 ++++ t/sources/basic.HU | 69 ++++ t/sources/basic.IT | 69 ++++ t/sources/basic.NL | 69 ++++ t/sources/basic.PT | 69 ++++ t/update-deparse.raku | 28 ++ 19 files changed, 1025 insertions(+), 818 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 Changes create mode 100644 LICENSE create mode 100644 META6.json create mode 100644 dist.ini create mode 100644 lib/L10N.rakumod delete mode 100644 localizations/CORE create mode 100644 t/basic.rakutest create mode 100644 t/sources/basic create mode 100644 t/sources/basic.DE create mode 100644 t/sources/basic.EN create mode 100644 t/sources/basic.FR create mode 100644 t/sources/basic.HU create mode 100644 t/sources/basic.IT create mode 100644 t/sources/basic.NL create mode 100644 t/sources/basic.PT create mode 100755 t/update-deparse.raku diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..c1720f0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,31 @@ +name: test + +on: + push: + branches: + - '*' + tags-ignore: + - '*' + pull_request: + +jobs: + raku: + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + raku-version: + - 'latest' + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: Raku/setup-raku@v1 + with: + raku-version: ${{ matrix.raku-version }} + - name: Install App::Prove6 + run: zef install --/test App::Prove6 + - name: Run Tests + run: prove6 -I. t diff --git a/.gitignore b/.gitignore index b0af960..169f9bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ +.precomp/ localizations/*/.precomp/ +localizations/*/lib/.precomp/ localizations/*/releases/ diff --git a/Changes b/Changes new file mode 100644 index 0000000..4d41618 --- /dev/null +++ b/Changes @@ -0,0 +1,4 @@ +Revision history for L10N + +{{$NEXT}} + - Initial version diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..32efefc --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + The Artistic License 2.0 + + Copyright (c) 2000-2006, The Perl Foundation. + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +Preamble + +This license establishes the terms under which a given free software +Package may be copied, modified, distributed, and/or redistributed. +The intent is that the Copyright Holder maintains some artistic +control over the development of that Package while still keeping the +Package available as open source and free software. + +You are always permitted to make arrangements wholly outside of this +license directly with the Copyright Holder of a given Package. If the +terms of this license do not permit the full use that you propose to +make of the Package, you should contact the Copyright Holder and seek +a different licensing arrangement. + +Definitions + + "Copyright Holder" means the individual(s) or organization(s) + named in the copyright notice for the entire Package. + + "Contributor" means any party that has contributed code or other + material to the Package, in accordance with the Copyright Holder's + procedures. + + "You" and "your" means any person who would like to copy, + distribute, or modify the Package. + + "Package" means the collection of files distributed by the + Copyright Holder, and derivatives of that collection and/or of + those files. A given Package may consist of either the Standard + Version, or a Modified Version. + + "Distribute" means providing a copy of the Package or making it + accessible to anyone else, or in the case of a company or + organization, to others outside of your company or organization. + + "Distributor Fee" means any fee that you charge for Distributing + this Package or providing support for this Package to another + party. It does not mean licensing fees. + + "Standard Version" refers to the Package if it has not been + modified, or has been modified only in ways explicitly requested + by the Copyright Holder. + + "Modified Version" means the Package, if it has been changed, and + such changes were not explicitly requested by the Copyright + Holder. + + "Original License" means this Artistic License as Distributed with + the Standard Version of the Package, in its current version or as + it may be modified by The Perl Foundation in the future. + + "Source" form means the source code, documentation source, and + configuration files for the Package. + + "Compiled" form means the compiled bytecode, object code, binary, + or any other form resulting from mechanical transformation or + translation of the Source form. + + +Permission for Use and Modification Without Distribution + +(1) You are permitted to use the Standard Version and create and use +Modified Versions for any purpose without restriction, provided that +you do not Distribute the Modified Version. + + +Permissions for Redistribution of the Standard Version + +(2) You may Distribute verbatim copies of the Source form of the +Standard Version of this Package in any medium without restriction, +either gratis or for a Distributor Fee, provided that you duplicate +all of the original copyright notices and associated disclaimers. At +your discretion, such verbatim copies may or may not include a +Compiled form of the Package. + +(3) You may apply any bug fixes, portability changes, and other +modifications made available from the Copyright Holder. The resulting +Package will still be considered the Standard Version, and as such +will be subject to the Original License. + + +Distribution of Modified Versions of the Package as Source + +(4) You may Distribute your Modified Version as Source (either gratis +or for a Distributor Fee, and with or without a Compiled form of the +Modified Version) provided that you clearly document how it differs +from the Standard Version, including, but not limited to, documenting +any non-standard features, executables, or modules, and provided that +you do at least ONE of the following: + + (a) make the Modified Version available to the Copyright Holder + of the Standard Version, under the Original License, so that the + Copyright Holder may include your modifications in the Standard + Version. + + (b) ensure that installation of your Modified Version does not + prevent the user installing or running the Standard Version. In + addition, the Modified Version must bear a name that is different + from the name of the Standard Version. + + (c) allow anyone who receives a copy of the Modified Version to + make the Source form of the Modified Version available to others + under + + (i) the Original License or + + (ii) a license that permits the licensee to freely copy, + modify and redistribute the Modified Version using the same + licensing terms that apply to the copy that the licensee + received, and requires that the Source form of the Modified + Version, and of any works derived from it, be made freely + available in that license fees are prohibited but Distributor + Fees are allowed. + + +Distribution of Compiled Forms of the Standard Version +or Modified Versions without the Source + +(5) You may Distribute Compiled forms of the Standard Version without +the Source, provided that you include complete instructions on how to +get the Source of the Standard Version. Such instructions must be +valid at the time of your distribution. If these instructions, at any +time while you are carrying out such distribution, become invalid, you +must provide new instructions on demand or cease further distribution. +If you provide valid instructions or cease distribution within thirty +days after you become aware that the instructions are invalid, then +you do not forfeit any of your rights under this license. + +(6) You may Distribute a Modified Version in Compiled form without +the Source, provided that you comply with Section 4 with respect to +the Source of the Modified Version. + + +Aggregating or Linking the Package + +(7) You may aggregate the Package (either the Standard Version or +Modified Version) with other packages and Distribute the resulting +aggregation provided that you do not charge a licensing fee for the +Package. Distributor Fees are permitted, and licensing fees for other +components in the aggregation are permitted. The terms of this license +apply to the use and Distribution of the Standard or Modified Versions +as included in the aggregation. + +(8) You are permitted to link Modified and Standard Versions with +other works, to embed the Package in a larger work of your own, or to +build stand-alone binary or bytecode versions of applications that +include the Package, and Distribute the result without restriction, +provided the result does not expose a direct interface to the Package. + + +Items That are Not Considered Part of a Modified Version + +(9) Works (including, but not limited to, modules and scripts) that +merely extend or make use of the Package, do not, by themselves, cause +the Package to be a Modified Version. In addition, such works are not +considered parts of the Package itself, and are not subject to the +terms of this license. + + +General Provisions + +(10) Any use, modification, and distribution of the Standard or +Modified Versions is governed by this Artistic License. By using, +modifying or distributing the Package, you accept this license. Do not +use, modify, or distribute the Package, if you do not accept this +license. + +(11) If your Modified Version has been derived from a Modified +Version made by someone other than you, you are nevertheless required +to ensure that your Modified Version complies with the requirements of +this license. + +(12) This license does not grant you the right to use any trademark, +service mark, tradename, or logo of the Copyright Holder. + +(13) This license includes the non-exclusive, worldwide, +free-of-charge patent license to make, have made, use, offer to sell, +sell, import and otherwise transfer the Package with respect to any +patent claims licensable by the Copyright Holder that are necessarily +infringed by the Package. If you institute patent litigation +(including a cross-claim or counterclaim) against any party alleging +that the Package constitutes direct or contributory patent +infringement, then this Artistic License to you shall terminate on the +date that such litigation is filed. + +(14) Disclaimer of Warranty: +THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS +IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR +NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL +LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/META6.json b/META6.json new file mode 100644 index 0000000..6f256d0 --- /dev/null +++ b/META6.json @@ -0,0 +1,33 @@ +{ + "auth": "zef:l10n", + "authors": [ + "Elizabeth Mattijsen" + ], + "build-depends": [ + ], + "depends": [ + "L10N::DE:ver<0.0.1>:auth", + "L10N::EN:ver<0.0.1>:auth", + "L10N::FR:ver<0.0.1>:auth", + "L10N::HU:ver<0.0.1>:auth", + "L10N::IT:ver<0.0.1>:auth", + "L10N::NL:ver<0.0.1>:auth", + "L10N::PT:ver<0.0.1>:auth" + ], + "description": "All official localizations of Raku", + "license": "Artistic-2.0", + "name": "L10N", + "perl": "6.d", + "provides": { + "L10N": "lib/L10N.rakumod" + }, + "resources": [ + ], + "source-url": "https://github.com/raku/L10N", + "tags": [ + "LOCALIZATION" + ], + "test-depends": [ + ], + "version": "0.0.1" +} diff --git a/README.md b/README.md index e4ecd68..95348d7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,33 @@ -# Raku Localizations +[![Actions Status](https://github.com/Raku/L10N/actions/workflows/test.yml/badge.svg)](https://github.com/Raku/L10N/actions) + +NAME +==== + +L10N - All official localizations of Raku + +SYNOPSIS +======== + +```raku +use L10N; +``` + +DESCRIPTION +=========== + +L10N is a distribution that, when installed, will install all official localizations of the Raku Programming Language as its dependencies. + +It will not install anything else. + +AUTHOR +====== + +Elizabeth Mattijsen + +COPYRIGHT AND LICENSE +===================== + +Copyright 2023 Raku Localization Team + +This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. -This repository contains the logic to provide officially supported localizations of the Raku Programming Language. diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..0a9f810 --- /dev/null +++ b/dist.ini @@ -0,0 +1,9 @@ +name = L10N + +[ReadmeFromPod] +filename = lib/L10N.rakumod + +[UploadToZef] + +[Badges] +provider = github-actions/test.yml diff --git a/lib/L10N.rakumod b/lib/L10N.rakumod new file mode 100644 index 0000000..2e0cd01 --- /dev/null +++ b/lib/L10N.rakumod @@ -0,0 +1,32 @@ +=begin pod + +=head1 NAME + +L10N - All official localizations of Raku + +=head1 SYNOPSIS + +=begin code :lang + +use L10N; + +=end code + +=head1 DESCRIPTION + +L10N is a distribution that, when installed, will install all official +localizations of the Raku Programming Language as its dependencies. + +It will not install anything else. + +=head1 AUTHOR + +Elizabeth Mattijsen + +=head1 COPYRIGHT AND LICENSE + +Copyright 2023 Raku Localization Team + +This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0. + +=end pod diff --git a/localizations/CORE b/localizations/CORE deleted file mode 100644 index 93e1e74..0000000 --- a/localizations/CORE +++ /dev/null @@ -1,816 +0,0 @@ -# This file contains that "null" translation of features of the Raku -# Programming Language, and as such only has meaning as a template for -# other translations. -# -# Please note that as the Raku Programming Language evolves, further -# elements may be added, so any translations will probably need to be -# updated by then as well. -# -# The keys consist of 2 parts: before the first hyphen is a type indication -# of the syntax, followed by the name of the feature in the syntax. The -# following type indications exist so far: -# -# adverb-pc core adverbs on postcircumfixes (:exists, :delete, etc.) -# adverb-q quote language adverbs ("to","ww","v", etc.) -# adverb-rx core adverbs on regexes (:i, :m, :ignorecase, etc.) -# block syntax involving a block -# core sub/method names that are part of the Raku core -# constraint related to (ad-hoc) constraints -# infix infix operators consisting of alphanumeric characters -# meta meta-operator prefixes ('R','X','Z') -# modifier statement modifier syntax -# multi types of multi syntax -# named named arguments to methods/subs (:k,:p,:absolute, etc.) -# package package declarators -# pragma compile-time pragmas ("lib","precompilation", etc.) -# prefix prefix operators consisting of alphanumeric characters -# phaser types of phasers ("BEGIN","END","CHECK", etc.) -# routine types of named code blocks -# quote-lang quote language markers ("q","Q","qq", etc.) -# scope types of scope ("my","our","state", etc.) -# stmt-prefix statement prefixes ("do","eager","lazy", etc.) -# system methods called by the system (TWEAK,BUILD,ACCEPTS etc.) -# term terms ("time","now","self",etc.) -# trait types of traits ("is","does","returns", etc.) -# typer type constructors ("enum","subset") -# use use related ("use","no","require", etc.) -# -# Each line that does not start with a '#", is considered to contain two -# words: the first is the key known to the localization logic of the Raku -# Programming Language. The second word is supposed to be the translation -# in the given language. -# -# Please note that the second word currently *must* adhere to Raku identifier -# rules, so that they must start with a \w character (which includes the -# underscore), and may have a hyphen as long as it is not the last character -# if the word, and as long as there are no two consecutive hyphens. - -# KEY TRANSLATION -adverb-pc-delete delete -adverb-pc-exists exists -adverb-pc-k k -adverb-pc-kv kv -adverb-pc-p p -adverb-pc-v v - -# KEY TRANSLATION -adverb-q-a a -adverb-q-array array -adverb-q-b b -adverb-q-backslash backslash -adverb-q-c c -adverb-q-closure closure -adverb-q-double double -adverb-q-exec exec -adverb-q-f f -adverb-q-format format -adverb-q-function function -adverb-q-h h -adverb-q-hash hash -adverb-q-heredoc heredoc -adverb-q-o o -adverb-q-q q -adverb-q-qq qq -adverb-q-quotewords quotewords -adverb-q-s s -adverb-q-scalar scalar -adverb-q-single single -adverb-q-to to -adverb-q-v v -adverb-q-val val -adverb-q-w w -adverb-q-words words -adverb-q-ww ww -adverb-q-x x - -# KEY TRANSLATION -adverb-rx-c c -adverb-rx-continue continue -adverb-rx-ex ex -adverb-rx-exhaustive exhaustive -adverb-rx-g g -adverb-rx-global global -adverb-rx-i i -adverb-rx-ignorecase ignorecase -adverb-rx-ignoremark ignoremark -adverb-rx-ii ii -adverb-rx-m m -adverb-rx-mm mm -adverb-rx-nd nd -adverb-rx-nth nth -adverb-rx-ov ov -adverb-rx-overlap overlap -adverb-rx-p p -adverb-rx-pos pos -adverb-rx-r r -adverb-rx-ratchet ratchet -adverb-rx-rd rd -adverb-rx-s s -adverb-rx-samecase samecase -adverb-rx-samemark samemark -adverb-rx-samespace samespace -adverb-rx-sigspace sigspace -adverb-rx-ss ss -adverb-rx-st st -adverb-rx-to to -adverb-rx-x x - -# KEY TRANSLATION -block-default default -block-else else -block-elsif elsif -block-for for -block-given given -block-if if -block-loop loop -block-orwith orwith -block-repeat repeat -block-unless unless -block-until until -block-when when -block-whenever whenever -block-while while -block-with with -block-without without - -# KEY TRANSLATION -constraint-where where - -# KEY TRANSLATION -core-abs abs -core-all all -core-antipairs antipairs -core-any any -core-append append -core-ast ast -core-atomic-add-fetch atomic-add-fetch -core-atomic-assign atomic-assign -core-atomic-dec-fetch atomic-dec-fetch -core-atomic-fetch atomic-fetch -core-atomic-fetch-add atomic-fetch-add -core-atomic-fetch-dec atomic-fetch-dec -core-atomic-fetch-inc atomic-fetch-inc -core-atomic-fetch-sub atomic-fetch-sub -core-atomic-inc-fetch atomic-inc-fetch -core-atomic-sub-fetch atomic-sub-fetch -core-await await - -# KEY TRANSLATION -core-bag bag -core-bail-out bail-out -core-bless bless - -# KEY TRANSLATION -core-callframe callframe -core-callsame callsame -core-callwith callwith -core-can-ok can-ok -core-cas cas -core-categorize categorize -core-ceiling ceiling -core-chars chars -core-chdir chdir -core-chmod chmod -core-chomp chomp -core-chop chop -core-chown chown -core-chr chr -core-chrs chrs -core-classify classify -core-close close -core-cmp-ok cmp-ok -core-codes codes -core-comb comb -core-combinations combinations -core-conj conj -core-contains contains -core-cross cross - -# KEY TRANSLATION -core-decode decode -core-deepmap deepmap -core-defined defined -core-diag diag -core-die die -core-dies-ok dies-ok -core-dir dir -core-does-ok does-ok -core-done done -core-duckmap duckmap - -# KEY TRANSLATION -core-elems elems -core-emit emit -core-encode encode -core-end end -core-ends-with ends-with -core-eval-dies-ok eval-dies-ok -core-eval-lives-ok eval-lives-ok -core-exit exit -core-exp exp -core-expmod expmod - -# KEY TRANSLATION -core-fail fail -core-fails-like fails-like -core-fc fc -core-first first -core-flat flat -core-flip flip -core-floor floor -core-flunk flunk -core-fmt fmt -core-full-barrier full-barrier - -# KEY TRANSLATION -core-get get -core-getc getc -core-gist gist -core-grep grep - -# KEY TRANSLATION -core-hash hash -core-head head - -# KEY TRANSLATION -core-indent indent -core-index index -core-indices indices -core-indir indir -core-is is -core-is-approx is-approx -core-is-deeply is-deeply -core-is-prime is-prime -core-isa-ok isa-ok -core-isnt isnt -core-item item - -# KEY TRANSLATION -core-join join - -# KEY TRANSLATION -core-key key -core-keys keys -core-kv kv - -# KEY TRANSLATION -core-last last -core-lastcall lastcall -core-lc lc -core-like like -core-lines lines -core-link link -core-list list -core-lives-ok lives-ok -core-lsb lsb - -# KEY TRANSLATION -core-make make -core-map map -core-match match -core-max max -core-min min -core-minmax minmax -core-mix mix -core-mkdir mkdir -core-move move -core-msb msb - -# KEY TRANSLATION -core-new new -core-next next -core-nextcallee nextcallee -core-nextsame nextsame -core-nextwith nextwith -core-nok nok -core-none none -core-not not -core-note note - -# KEY TRANSLATION -core-ok ok -core-one one -core-open open -core-ord ord -core-ords ords - -# KEY TRANSLATION -core-pair pair -core-pairs pairs -core-parse-base parse-base -core-pass pass -core-permutations permutations -core-pick pick -core-plan plan -core-pop pop -core-prepend prepend -core-print print -core-printf printf -core-proceed proceed -core-prompt prompt -core-push push -core-put put - -# KEY TRANSLATION -core-rand rand -core-redo redo -core-reduce reduce -core-repeated repeated -core-repl repl -core-return return -core-return-rw return-rw -core-reverse reverse -core-rindex rindex -core-rmdir rmdir -core-roll roll -core-roots roots -core-rotate rotate -core-round round -core-roundrobin roundrobin -core-run run - -# KEY TRANSLATION -core-samecase samecase -core-samemark samemark -core-samewith samewith -core-say say -core-set set -core-shell shell -core-shift shift -core-sign sign -core-signal signal -core-skip skip -core-skip-rest skip-rest -core-sleep sleep -core-sleep-timer sleep-timer -core-sleep-until sleep-until -core-slip slip -core-slurp slurp -core-snip snip -core-snitch snitch -core-so so -core-sort sort -core-splice splice -core-split split -core-sprintf sprintf -core-spurt spurt -core-sqrt sqrt -core-squish squish -core-srand srand -core-starts-with starts-with -core-subbuf subbuf -core-subbuf-rw subbuf-rw -core-subst subst -core-substr substr -core-substr-eq substr-eq -core-substr-rw substr-rw -core-subtest subtest -core-succeed succeed -core-sum sum -core-symlink symlink - -# KEY TRANSLATION -core-tail tail -core-take take -core-take-rw take-rw -core-tc tc -core-tclc tclc -core-throws-like throws-like -core-todo todo -core-trans trans -core-trim trim -core-trim-leading trim-leading -core-trim-trailing trim-trailing -core-truncate truncate - -# KEY TRANSLATION -core-uc uc -core-unimatch unimatch -core-uniname uniname -core-uninames uninames -core-uniparse uniparse -core-uniprop uniprop -core-uniprops uniprops -core-unique unique -core-unival unival -core-univals univals -core-unlike unlike -core-unlink unlink -core-unpolar unpolar -core-unshift unshift -core-use-ok use-ok - -# KEY TRANSLATION -core-val val -core-value value -core-values values - -# KEY TRANSLATION -core-warn warn -core-wordcase wordcase -core-words words - -# KEY TRANSLATION -core-zip zip - -# KEY TRANSLATION -infix-(cont) (cont) -infix-(elem) (elem) -infix-^ff ^ff -infix-^ff^ ^ff^ -infix-^fff ^fff -infix-^fff^ ^fff^ -infix-after after -infix-and and -infix-andthen andthen -infix-before before -infix-but but -infix-cmp cmp -infix-coll coll -infix-div div -infix-does does -infix-eq eq -infix-ff ff -infix-ff^ ff^ -infix-fff fff -infix-fff^ fff^ -infix-gcd gcd -infix-ge ge -infix-gt gt -infix-lcm lcm -infix-le le -infix-leg leg -infix-lt lt -infix-max max -infix-min min -infix-minmax minmax -infix-mod mod -infix-ne ne -infix-notandthen notandthen -infix-o o -infix-or or -infix-orelse orelse -infix-unicmp unicmp -infix-x x -infix-X X -infix-xx xx -infix-Z Z - -# KEY TRANSLATION -meta-R R -meta-X X -meta-Z Z - -# KEY TRANSLATION -modifier-for for -modifier-given given -modifier-if if -modifier-unless unless -modifier-until until -modifier-when when -modifier-while while -modifier-with with -modifier-without without - -# KEY TRANSLATION -multi-multi multi -multi-only only -multi-proto proto - -# KEY TRANSLATION -named-absolute absolute -named-actions actions -named-api api -named-append append -named-arg0 arg0 -named-args args -named-as as -named-at at -named-auth auth - -# KEY TRANSLATION -named-basename basename -named-batch batch -named-bin bin -named-bleed bleed -named-broadcast broadcast - -# KEY TRANSLATION -named-catch catch -named-check check -named-chomp chomp -named-close close -named-command command -named-complement complement -named-completely completely -named-continue continue -named-control control -named-count count -named-create create -named-createonly createonly -named-cwd cwd -named-CWD CWD - -# KEY TRANSLATION -named-datagram datagram -named-date date -named-day day -named-degree degree -named-delete delete -named-dirname dirname - -# KEY TRANSLATION -named-elems elems -named-emit-timed emit-timed -named-enc enc -named-encoding encoding -named-end end -named-err err -named-every every -named-ex ex -named-exclusive exclusive -named-exhaustive exhaustive -named-expires expires - -# KEY TRANSLATION -named-family family -named-filename filename -named-filter filter -named-formatter formatter - -# KEY TRANSLATION -named-g g -named-gid gid -named-global global - -# KEY TRANSLATION -named-host host -named-hour hour - -# KEY TRANSLATION -named-i i -named-ignorecase ignorecase -named-ignoremark ignoremark -named-ii ii -named-in in -named-into into - -# KEY TRANSLATION -named-joiner joiner - -# KEY TRANSLATION -named-k k -named-key key -named-kv kv - -# KEY TRANSLATION -named-listen listen -named-localhost localhost -named-localport localport - -# KEY TRANSLATION -named-match match -named-merge merge -named-minute minute -named-mm mm -named-mode mode -named-month month - -# KEY TRANSLATION -named-name name -named-nd nd -named-nl nl -named-nl-in nl-in -named-nl-out nl-out -named-non-blocking non-blocking -named-nth nth - -# KEY TRANSLATION -named-off off -named-out out -named-out-buffer out-buffer -named-ov ov -named-overlap overlap - -# KEY TRANSLATION -named-p p -named-partial partial -named-parts parts -named-port port -named-pos pos -named-primary primary - -# KEY TRANSLATION -named-quaternary quaternary - -# KEY TRANSLATION -named-r r -named-rd rd -named-real real -named-replacement replacement -named-rule rule -named-rw rw -named-rx rx - -# KEY TRANSLATION -named-samecase samecase -named-samespace samespace -named-scheduler scheduler -named-second second -named-secondary secondary -named-seconds seconds -named-shared shared -named-size size -named-slip slip -named-SPEC SPEC -named-squash squash -named-ss ss -named-st st -named-status status -named-strict strict -named-subscript subscript -named-superscript superscript - -# KEY TRANSLATION -named-tertiary tertiary -named-test test -named-th th -named-times times -named-timezone timezone -named-translate-nl translate-nl -named-truncate truncate - -# KEY TRANSLATION -named-uid uid -named-update update - -# KEY TRANSLATION -named-v v -named-value value -named-vent-at vent-at -named-ver ver -named-volume volume - -# KEY TRANSLATION -named-w w -named-where where -named-win-verbatim-args win-verbatim-args - -# KEY TRANSLATION -named-x x - -# KEY TRANSLATION -named-year year - -# KEY TRANSLATION -package-class class -package-grammar grammar -package-module module -package-package package -package-role role - -# KEY TRANSLATION -phaser-BEGIN BEGIN -phaser-CATCH CATCH -phaser-CHECK CHECK -phaser-CLOSE CLOSE -phaser-CONTROL CONTROL -phaser-DOC DOC -phaser-END END -phaser-ENTER ENTER -phaser-FIRST FIRST -phaser-INIT INIT -phaser-KEEP KEEP -phaser-LAST LAST -phaser-LEAVE LEAVE -phaser-NEXT NEXT -phaser-POST POST -phaser-PRE PRE -phaser-QUIT QUIT -phaser-UNDO UNDO - -# KEY TRANSLATION -pragma-dynamic-scope dynamic-scope -pragma-fatal fatal -pragma-isms isms -pragma-lib lib -pragma-MONKEY MONKEY -pragma-MONKEY-GUTS MONKEY-GUTS -pragma-MONKEY-SEE-NO-EVAL MONKEY-SEE-NO-EVAL -pragma-MONKEY-TYPING MONKEY-TYPING -pragma-nqp nqp -pragma-precompilation precompilation -pragma-soft soft -pragma-strict strict -pragma-trace trace -pragma-variables variables -pragma-worries worries - -# KEY TRANSLATION -prefix-not not -prefix-so so - -# KEY TRANSLATION -quote-lang-m m -quote-lang-ms ms -quote-lang-q q -quote-lang-Q Q -quote-lang-qq qq -quote-lang-rx rx -quote-lang-s s -quote-lang-S S -quote-lang-ss ss -quote-lang-Ss Ss - -# KEY TRANSLATION -routine-method method -routine-regex regex -routine-rule rule -routine-sub sub -routine-submethod submethod -routine-token token - -# KEY TRANSLATION -scope-anon anon -scope-augment augment -scope-constant constant -scope-has has -scope-HAS HAS -scope-my my -scope-our our -scope-state state -scope-unit unit - -# KEY TRANSLATION -stmt-prefix-also also -stmt-prefix-do do -stmt-prefix-eager eager -stmt-prefix-gather gather -stmt-prefix-hyper hyper -stmt-prefix-lazy lazy -stmt-prefix-quietly quietly -stmt-prefix-race race -stmt-prefix-react react -stmt-prefix-sink sink -stmt-prefix-start start -stmt-prefix-supply supply -stmt-prefix-try try - -# KEY TRANSLATION -system-ACCEPTS ACCEPTS -system-BUILD BUILD -system-CALL-ME CALL-ME -system-COERCE COERCE -system-FALLBACK FALLBACK -system-MAIN MAIN -system-TWEAK TWEAK -system-UPGRADE-RAT UPGRADE-RAT - -# KEY TRANSLATION -term-nano nano -term-now now -term-pi pi -term-rand rand -term-self self -term-tau tau -term-time time - -# KEY TRANSLATION -trait-is-built built -trait-is-copy copy -trait-is-default default -trait-is-DEPRECATED DEPRECATED -trait-is-equiv equiv -trait-is-export export -trait-is-hidden-from-backtrace hidden-from-backtrace -trait-is-hidden-from-USAGE hidden-from-USAGE -trait-is-implementation-detail implementation-detail -trait-is-looser looser -trait-is-nodal nodal -trait-is-pure pure -trait-is-raw raw -trait-is-rw rw -trait-is-test-assertion test-assertion -trait-is-tighter tighter - -# KEY TRANSLATION -traitmod-does does -traitmod-handles handles -traitmod-hides hides -traitmod-is is -traitmod-of of -traitmod-returns returns -traitmod-trusts trusts - -# KEY TRANSLATION -typer-enum enum -typer-subset subset - -# KEY TRANSLATION -use-import import -use-need need -use-no no -use-require require -use-use use - -# vim: expandtab shiftwidth=4 diff --git a/t/basic.rakutest b/t/basic.rakutest new file mode 100644 index 0000000..6ee7eaf --- /dev/null +++ b/t/basic.rakutest @@ -0,0 +1,79 @@ +use v6.e.PREVIEW; +use Test; + +#------------------------------------------------------------------------------- +# Stolen from the Trap ecosystem module +class Trap { + has str @!text; + + method print(*@_ --> True) { + @!text.push: @_.join + } + method say(*@_ --> True) { # older versions of Raku + @!text.push: @_.join ~ "\n" + } + method printf($format, *@_ --> True) { # older versions of Raku + @!text.push: sprintf($format, @_) + } + + method text(--> str) { @!text.join } + + multi method CALL-ME(Trap:U: $one is raw) { + $one = self.new + } + multi method CALL-ME(Trap:U: $one is raw, $two is raw) { + $one = $two = self.new + } +} +#------------------------------------------------------------------------------- +# Capture all output from running a given AST + +sub output($ast) { + my $merged = Trap(my $*OUT, my $*ERR); + $ast.EVAL; + $merged.text +} + +#------------------------------------------------------------------------------- + +my $REPO = $*REPO; +my $localizations := $*PROGRAM.parent.parent.add("localizations"); +my @localizations = $localizations.dir.map({ .basename if .d }).sort; +plan 4 * @localizations; + +# Where we keep the source code to be tested +my $sources := $*PROGRAM.sibling("sources"); + +# The basic source file, human written +my $basic := $sources.add("basic").slurp; + +# The RakuAST of the basic source file +my $basic-ast := $basic.AST; + +# Expected output when running the basic source file +my $basic-out := output($basic-ast); + +for @localizations { + + # Make sure we get the localization module locally + my $*REPO := CompUnit::Repository::FileSystem.new( + prefix => $localizations.add($_).add("lib"), + next-repo => $REPO + ); + + my $expected := $sources.add("basic.$_").slurp; + is $basic-ast.DEPARSE($_), $expected, "$_: did the deparsing match"; + + my $ast := $expected.AST($_); + is-deeply $ast, $basic-ast, + "$_: did the source create the same AST with (:slang)"; + + $ast := "use L10N::$_;\n$expected".AST; + # need to ignore the "use" statement itself + is-deeply $ast.statements[1..*], $basic-ast.statements, + "$_: did the source create the same AST with 'use'"; + + is output($ast), $basic-out, "$_: did it generate the same output"; +} + +# vim: expandtab shiftwidth=4 diff --git a/t/sources/basic b/t/sources/basic new file mode 100644 index 0000000..f233cf4 --- /dev/null +++ b/t/sources/basic @@ -0,0 +1,91 @@ +# This file contains some very basic Raku code that serves as +# a base for localizations. It is Raku code such as a programmer +# would write, rather than how Raku would deparse this code in +# English. + +{ + ENTER say "hello"; + LEAVE say "goodbye"; +} + +sub answer() returns Int is raw { 42 } + +my class Frobnicate { + has $.a = 666; + submethod TWEAK() { + $!a = 42; + } + multi method foo { + say self.a + } +} + +say Frobnicate.new.foo; + +my $a = 41; +my $b where * >= 666 = 666; + +say $b R/ $a; + +say 42 (elem) 1..100; + +if $a { + $a++; +} +elsif $b { + die "That is not the right number!"; +} +else { + note "Shouldn't see this"; +} + +say "incremented" if $a == answer; + +with $a { + say $a; +} +orwith $b { + warn "still not the right number"; +} + +given 666 { + when 42 { + say "the answer"; + } + default { + quietly warn "No answer"; + } +} + +no strict; +$c = 137; +dd $c.indent(4); + +use strict; +my @a = ^10; +say @a.first(* %% 2, :end); + +my %h = a => 666; +say %h:delete; + +put qq:to/HERE/; +heredoc +HERE + +for ^3 { .say } + +.say for ; + +loop { + say "loop"; + last; +} + +my enum KNOBS ; +say down; + +my subset FOO of Int where * > 666; +my FOO $foo = 1000; +say $foo; + +# vim: expandtab shiftwidth=4 diff --git a/t/sources/basic.DE b/t/sources/basic.DE new file mode 100644 index 0000000..8126909 --- /dev/null +++ b/t/sources/basic.DE @@ -0,0 +1,69 @@ +{ + EINTRITT sag "hello"; + VERLASSE sag "goodbye" +} +sub answer returns Int ist roh { + 42 +} +mein klasse Frobnicate { + hat $.a = 666; + submethode TWEAK { + $!a = 42 + } + multi methode foo { + sag selbst.a + } +} +sag Frobnicate.neu.foo; +mein $a = 41; +mein $b wobei * >= 666 = 666; +sag $b U/ $a; +sag 42 (element) 1 .. 100; +wenn $a { + $a++ +} +sonstwenn $b { + sterb "That is not the right number!" +} +sonst { + notiere "Shouldn't see this" +} +sag "incremented" wenn $a == answer; +mit $a { + sag $a +} +odermit $b { + warne "still not the right number" +} +gegeben 666 { + wann 42 { + sag "the answer" + } + standard { + leise warne "No answer" + } +} +kein strict; +$c = 137; +dd $c.einzug(4); +verwende strict; +mein @a = ^10; +sag @a.erste(* %% 2, :vonende); +mein %h = a => 666; +sag %h:entferne; +sag-es qq:to/HERE/; +heredoc +HERE +füralle ^3 { + .sag +} +.sag füralle ; +schleife { + sag "loop"; + letzte +} +mein enum KNOBS ; +sag down; +mein subset FOO wie Int wobei * > 666; +mein FOO $foo = 1000; +sag $foo diff --git a/t/sources/basic.EN b/t/sources/basic.EN new file mode 100644 index 0000000..1fe3a92 --- /dev/null +++ b/t/sources/basic.EN @@ -0,0 +1,69 @@ +{ + ENTER say "hello"; + LEAVE say "goodbye" +} +sub answer returns Int is raw { + 42 +} +my class Frobnicate { + has $.a = 666; + submethod TWEAK { + $!a = 42 + } + multi method foo { + say self.a + } +} +say Frobnicate.new.foo; +my $a = 41; +my $b where * >= 666 = 666; +say $b R/ $a; +say 42 (elem) 1 .. 100; +if $a { + $a++ +} +elsif $b { + die "That is not the right number!" +} +else { + note "Shouldn't see this" +} +say "incremented" if $a == answer; +with $a { + say $a +} +orwith $b { + warn "still not the right number" +} +given 666 { + when 42 { + say "the answer" + } + default { + quietly warn "No answer" + } +} +no strict; +$c = 137; +dd $c.indent(4); +use strict; +my @a = ^10; +say @a.first(* %% 2, :end); +my %h = a => 666; +say %h:delete; +put qq:to/HERE/; +heredoc +HERE +for ^3 { + .say +} +.say for ; +loop { + say "loop"; + last +} +my enum KNOBS ; +say down; +my subset FOO of Int where * > 666; +my FOO $foo = 1000; +say $foo diff --git a/t/sources/basic.FR b/t/sources/basic.FR new file mode 100644 index 0000000..a25056a --- /dev/null +++ b/t/sources/basic.FR @@ -0,0 +1,69 @@ +{ + ENTRÉE dis "hello"; + SORS dis "goodbye" +} +sub answer renvoie Int est raw { + 42 +} +ma class Frobnicate { + a $.a = 666; + sousméthode TWEAK { + $!a = 42 + } + multi méthode foo { + dis sois.a + } +} +dis Frobnicate.nouveau.foo; +ma $a = 41; +ma $b où * >= 666 = 666; +dis $b R/ $a; +dis 42 (elem) 1 .. 100; +si $a { + $a++ +} +ousi $b { + meurs "That is not the right number!" +} +sinon { + note "Shouldn't see this" +} +dis "incremented" si $a == answer; +avec $a { + dis $a +} +ouavec $b { + préviens "still not the right number" +} +étantdonné 666 { + quand 42 { + dis "the answer" + } + défaut { + silencieusement préviens "No answer" + } +} +non strict; +$c = 137; +dd $c.indent(4); +utilise strict; +ma @a = ^10; +dis @a.premier(* %% 2, :end); +ma %h = a => 666; +dis %h:delete; +mets qq:to/HERE/; +heredoc +HERE +pour ^3 { + .dis +} +.dis pour ; +boucle { + dis "loop"; + dernier +} +ma énum KNOBS ; +dis down; +ma sousens FOO de Int où * > 666; +ma FOO $foo = 1000; +dis $foo diff --git a/t/sources/basic.HU b/t/sources/basic.HU new file mode 100644 index 0000000..b8bdd12 --- /dev/null +++ b/t/sources/basic.HU @@ -0,0 +1,69 @@ +{ + BELÉPÉS mond "hello"; + KILÉPÉS mond "goodbye" +} +szub answer visszatér Int ez nyers { + 42 +} +enyém osztály Frobnicate { + bír $.a = 666; + szubmetódus TWEAK { + $!a = 42 + } + multi metódus foo { + mond maga.a + } +} +mond Frobnicate.új.foo; +enyém $a = 41; +enyém $b ahol * >= 666 = 666; +mond $b R/ $a; +mond 42 (eleme) 1 .. 100; +ha $a { + $a++ +} +különbenha $b { + meghal "That is not the right number!" +} +különben { + megjegyez "Shouldn't see this" +} +mond "incremented" ha $a == answer; +ezzel $a { + mond $a +} +vagyezzel $b { + figyelmeztet "still not the right number" +} +adva 666 { + amikor 42 { + mond "the answer" + } + alapból { + halkan figyelmeztet "No answer" + } +} +nincs strict; +$c = 137; +dd $c.behúzás(4); +használ strict; +enyém @a = ^10; +mond @a.első(* %% 2, :végétől); +enyém %h = a => 666; +mond %h:töröl; +kitesz qq:to/HERE/; +heredoc +HERE +ezekre ^3 { + .mond +} +.mond ezekre ; +ciklus { + mond "loop"; + utolsó +} +enyém enum KNOBS ; +mond down; +enyém részhalmaz FOO ebből Int ahol * > 666; +enyém FOO $foo = 1000; +mond $foo diff --git a/t/sources/basic.IT b/t/sources/basic.IT new file mode 100644 index 0000000..2420cd7 --- /dev/null +++ b/t/sources/basic.IT @@ -0,0 +1,69 @@ +{ + ENTRA dillo "hello"; + VATTENE dillo "goodbye" +} +sub answer ritorna Int è raw { + 42 +} +il-mio classe Frobnicate { + ha $.a = 666; + submethod TWEAK { + $!a = 42 + } + multi metodo foo { + dillo se-stesso.a + } +} +dillo Frobnicate.new.foo; +il-mio $a = 41; +il-mio $b dove * >= 666 = 666; +dillo $b R/ $a; +dillo 42 (elem) 1 .. 100; +se $a { + $a++ +} +altro-se $b { + muori "That is not the right number!" +} +altro { + nota "Shouldn't see this" +} +dillo "incremented" se $a == answer; +con $a { + dillo $a +} +o-con $b { + avviso "still not the right number" +} +dato 666 { + quando 42 { + dillo "the answer" + } + predefinita { + tranquillamente avviso "No answer" + } +} +non strict; +$c = 137; +dd $c.indenta(4); +usare strict; +il-mio @a = ^10; +dillo @a.primo(* %% 2, :end); +il-mio %h = a => 666; +dillo %h:delete; +metti qq:to/HERE/; +heredoc +HERE +per ^3 { + .dillo +} +.dillo per ; +ciclo { + dillo "loop"; + ultimo +} +il-mio enum KNOBS ; +dillo down; +il-mio subset FOO da Int dove * > 666; +il-mio FOO $foo = 1000; +dillo $foo diff --git a/t/sources/basic.NL b/t/sources/basic.NL new file mode 100644 index 0000000..9f394a4 --- /dev/null +++ b/t/sources/basic.NL @@ -0,0 +1,69 @@ +{ + BINNENKOMST zeg "hello"; + AFSCHEID zeg "goodbye" +} +functie answer geeft-terug Int is rauw { + 42 +} +mijn klasse Frobnicate { + heeft $.a = 666; + submethode VERFIJN { + $!a = 42 + } + multi methode foo { + zeg zelf.a + } +} +zeg Frobnicate.nieuw.foo; +mijn $a = 41; +mijn $b waarbij * >= 666 = 666; +zeg $b O/ $a; +zeg 42 (element) 1 .. 100; +als $a { + $a++ +} +andersals $b { + sterf "That is not the right number!" +} +anders { + merk-op "Shouldn't see this" +} +zeg "incremented" als $a == answer; +met $a { + zeg $a +} +ofmet $b { + waarschuw "still not the right number" +} +gegeven 666 { + indien 42 { + zeg "the answer" + } + ingebreke { + stilletjes waarschuw "No answer" + } +} +geen strict; +$c = 137; +dd $c.indenteer(4); +gebruik strict; +mijn @a = ^10; +zeg @a.eerste(* %% 2, :vaneinde); +mijn %h = a => 666; +zeg %h:verwijder; +zeg-het dq:tot/HERE/; +heredoc +HERE +vooralle ^3 { + .zeg +} +.zeg vooralle ; +lus { + zeg "loop"; + laatste +} +mijn enum KNOBS ; +zeg down; +mijn subset FOO netals Int waarbij * > 666; +mijn FOO $foo = 1000; +zeg $foo diff --git a/t/sources/basic.PT b/t/sources/basic.PT new file mode 100644 index 0000000..e3f93fe --- /dev/null +++ b/t/sources/basic.PT @@ -0,0 +1,69 @@ +{ + ENTRADA diga "hello"; + SAIDA diga "goodbye" +} +sub answer retorna Int é raw { + 42 +} +meu classe Frobnicate { + tem $.a = 666; + submethod TWEAK { + $!a = 42 + } + multi método foo { + diga si-mesmo.a + } +} +diga Frobnicate.new.foo; +meu $a = 41; +meu $b quando * >= 666 = 666; +diga $b R/ $a; +diga 42 (elem) 1 .. 100; +se $a { + $a++ +} +se-não-se $b { + morra "That is not the right number!" +} +se-não { + nota "Shouldn't see this" +} +diga "incremented" se $a == answer; +com $a { + diga $a +} +ou-com $b { + avise "still not the right number" +} +dado 666 { + quando 42 { + diga "the answer" + } + predefinita { + tranquilamente avise "No answer" + } +} +não strict; +$c = 137; +dd $c.indente(4); +usa strict; +meu @a = ^10; +diga @a.primo(* %% 2, :end); +meu %h = a => 666; +diga %h:delete; +put qq:to/HERE/; +heredoc +HERE +por ^3 { + .diga +} +.diga por ; +ciclo { + diga "loop"; + último +} +meu enum KNOBS ; +diga down; +meu subset FOO do Int quando * > 666; +meu FOO $foo = 1000; +diga $foo diff --git a/t/update-deparse.raku b/t/update-deparse.raku new file mode 100755 index 0000000..47d0270 --- /dev/null +++ b/t/update-deparse.raku @@ -0,0 +1,28 @@ +#!/usr/bin/env RAKUDO_RAKUAST=1 raku + +use v6.*; + +# Helper script to update the localized deparse of available +# localizations. +# +# This script assumes that deparsing is correct at time of execution. + +my $io := $*PROGRAM.sibling("sources"); +say "Parsing basic code"; +my $ast := $io.add("basic").slurp.AST; +say " Done parsing basic code"; + +my $REPO = $*REPO; +my $localizations := $*PROGRAM.parent.parent.add("localizations"); + +for $localizations.dir.map({ .basename if .d }).sort { + say " Deparsing $_"; + + my $*REPO := CompUnit::Repository::FileSystem.new( + prefix => $localizations.add($_).add("lib"), + next-repo => $REPO + ); + $io.add("basic.$_").spurt($ast.DEPARSE($_)); +} + +# vim: expandtab shiftwidth=4