Open dselman opened 6 years ago
To fix #63 we need to be able to specify the locale for a template, with the default date/time format for the template based on the locale for the template.
This requires refactoring how we manage the template grammars within a template.
/grammar/template.tem
<-- default template. This is for the en-US
locale
/sample.txt
<-- sample.txt for the en-US
locale
/README.md
<-- readme file for the en-US
locale
/grammar/en-GB/template.tem
<-- a locale specific template
/grammar/en-GB/sample.txt
<-- sample.txt for the en-GB
locale
/grammar/en-GB/README.md
<-- readme file for the en-GB
locale
Locales are specified using IETF BCP 47 language tags.
A template may contain any number of locale specific sub-folders.
Note that the name of the template and the description of the template specified in package.json
are not localisable.
Template and Clause APIs that parse text and generate text will be extended to take an (optional) locale specifier.
Question: when we validate a template, do we validate all locales?
This proposal should be updated to reflect the new template directory structure from #435
The template specification must be extended to support locale-specific template grammar text.
This would allow a template developer to create a single template that had legal text in multiple natural languages, with a single data model and Ergo logic.
At present, a template can have multiple
sample.txt
instances (one per locale) but the grammar generation doe not take a locale as input.This should take into account locale specific formatting for monetary amounts and date/times. https://github.com/accordproject/cicero/issues/389
Docs for date/time formats: https://docs.accordproject.org/docs/markup-variables.html