Skip to content

Commit ff98ed9

Browse files
committed
Add Romanian language support
1 parent 96c3bf9 commit ff98ed9

File tree

28 files changed

+635
-27
lines changed

28 files changed

+635
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ build.ninja
2323
.catleg_secrets.toml
2424
*.tmp/
2525
perf.data*
26+
.DS_Store

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ The Catala language should be adapted to any legislative text that follows a
106106
general-to-specifics statutes order. Therefore, there exists multiple versions
107107
of the Catala surface syntax, adapted to the language of the legislative text.
108108

109-
Currently, Catala supports English, French and Polish legislative text via the
110-
`--language=en`, `--language=fr` or `--language=pl` options.
109+
Currently, Catala supports English, French, Polish and Romanian legislative text via the
110+
`--language=en`, `--language=fr`, `--language=pl` or `--language=ro` options.
111111

112112
To add support for a new language:
113113

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,17 @@ $(PY_VENV_DIR)/stamp: \
4040
runtimes/python/pyproject.toml \
4141
syntax_highlighting/en/pygments/pyproject.toml \
4242
syntax_highlighting/fr/pygments/pyproject.toml \
43-
syntax_highlighting/pl/pygments/pyproject.toml
43+
syntax_highlighting/pl/pygments/pyproject.toml \
44+
syntax_highlighting/ro/pygments/pyproject.toml
4445
test -d $(PY_VENV_DIR) || python3 -m venv $(PY_VENV_DIR)
4546
$(PY_VENV_ACTIVATE) python3 -m pip install -U pip
4647
$(PY_VENV_ACTIVATE) python3 -m pip install -U \
4748
-e $$(ocamlfind query dates_calc)/python \
4849
-e runtimes/python \
4950
-e syntax_highlighting/en/pygments \
5051
-e syntax_highlighting/fr/pygments \
51-
-e syntax_highlighting/pl/pygments
52+
-e syntax_highlighting/pl/pygments \
53+
-e syntax_highlighting/ro/pygments
5254
touch $@
5355

5456
dependencies-python: $(PY_VENV_DIR)
@@ -376,7 +378,7 @@ clean:
376378
rm -rf artifacts
377379

378380
inspect:
379-
gitinspector -f ml,mli,mly,iro,tex,catala,catala_en,catala_pl,catala_fr,md,fst,mld --grading
381+
gitinspector -f ml,mli,mly,iro,tex,catala,catala_en,catala_pl,catala_fr,catala_ro,md,fst,mld --grading
380382

381383
#> help_clerk : Display the clerk man page
382384
help_clerk:

build_system/clerk_driver.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ let backend_extensions =
131131
Clerk_rules.C, ["c"; "h"; "o"];
132132
Clerk_rules.OCaml, ["ml"; "mli"; "cmi"; "cmo"; "cmx"; "o"; "cmxs"];
133133
Clerk_rules.Python, ["py"];
134-
Clerk_rules.Java, ["java"; "class"];
135-
Clerk_rules.Tests, ["catala_en"; "catala_fr"; "catala_pl"];
134+
Clerk_rules.Java, ["java"; "class"; "jar"];
135+
Clerk_rules.Tests, ["catala_en"; "catala_fr"; "catala_pl"; "catala_ro"];
136136
]
137137

138138
let extensions_backend =
@@ -543,7 +543,8 @@ let build_direct_targets
543543
let is_module = ext = "" in
544544
match List.assoc_opt ext extensions_backend, ext with
545545
| Some bk, _ -> Left (ensure_target_dir (backend_subdir bk) t)
546-
| None, ("catala_en" | "catala_fr" | "catala_pl") -> Left t
546+
| None, ("catala_en" | "catala_fr" | "catala_pl" | "catala_ro") ->
547+
Left t
547548
| None, ("exe" | "jar") ->
548549
let t, backend =
549550
match ext, lastdirname t with

compiler/catala_utils/cli.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ open Global
2020
(* Manipulation of types used by flags & options *)
2121

2222
(** Associates a {!type: Global.backend_lang} with its string represtation. *)
23-
let languages = ["en", En; "fr", Fr; "pl", Pl]
23+
let languages = ["en", En; "fr", Fr; "pl", Pl; "ro", Ro]
2424

2525
let language_code =
2626
let rl = List.map (fun (a, b) -> b, a) languages in
@@ -42,7 +42,8 @@ let raw_file =
4242

4343
(* Some helpers for catala sources *)
4444

45-
let extensions = [".catala_fr", Fr; ".catala_en", En; ".catala_pl", Pl]
45+
let extensions =
46+
[".catala_fr", Fr; ".catala_en", En; ".catala_pl", Pl; ".catala_ro", Ro]
4647

4748
let file_lang filename =
4849
List.assoc_opt (Filename.extension filename) extensions

compiler/catala_utils/global.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
type file = string
1818
type raw_file = file
19-
type backend_lang = En | Fr | Pl
19+
type backend_lang = En | Fr | Pl | Ro
2020
type when_enum = Auto | Always | Never
2121
type message_format_enum = Human | GNU | Lsp
2222
type trace_format_enum = Human | JSON

compiler/catala_utils/global.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type raw_file = private file
2424
(** A file name that has not yet been resolved, [options.path_rewrite] must be
2525
called on it *)
2626

27-
type backend_lang = En | Fr | Pl
27+
type backend_lang = En | Fr | Pl | Ro
2828

2929
(** The usual auto/always/never option argument *)
3030
type when_enum = Auto | Always | Never

compiler/desugared/name_resolution.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,8 @@ let empty_module_ctxt lang =
12901290
(match lang with
12911291
| Global.En -> ["Present", present; "Absent", absent]
12921292
| Global.Fr -> ["Présent", present; "Absent", absent]
1293-
| Global.Pl -> ["Obecny", present; "Nieobecny", absent]));
1293+
| Global.Pl -> ["Obecny", present; "Nieobecny", absent]
1294+
| Global.Ro -> ["Prezent", present; "Absent", absent]));
12941295
topdefs = Ident.Map.empty;
12951296
used_modules = Ident.Map.empty;
12961297
is_external = false;

compiler/driver.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ open Shared_ast
2020

2121
(** Associates a file extension with its corresponding
2222
{!type: Global.backend_lang} string representation. *)
23-
let extensions = [".catala_fr", "fr"; ".catala_en", "en"; ".catala_pl", "pl"]
23+
let extensions =
24+
[
25+
".catala_fr", "fr";
26+
".catala_en", "en";
27+
".catala_pl", "pl";
28+
".catala_ro", "ro";
29+
]
2430

2531
let modname_of_file f =
2632
(* Fixme: make this more robust *)

compiler/literate/html.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ let ast_to_html
243243
| C.Fr -> "Sommaire"
244244
| C.En -> "Table of contents"
245245
| C.Pl -> "Spis treści."
246+
| C.Ro -> "Cuprins"
246247
in
247248

248249
Format.fprintf fmt

0 commit comments

Comments
 (0)