mrzool / invoice-boilerplate

Simple automated LaTeX invoicing system
http://mrzool.cc/tex-boilerplates/
GNU General Public License v2.0
702 stars 102 forks source link

Add localization controls to YAML template #9

Open ysndr opened 6 years ago

ysndr commented 6 years ago

Localization had to be done by editing the latex template and can now be done clearer and more efficiently via (optional) configuration keys

Note: lang was renamed to language as pandoc yelled at me how I dared to use lang with a value different from IETF style which isodate is not okay with.. commasep has become part of the localization object

I really like this tool, it came very handy recently

pedro-nonfree commented 5 years ago

lang was renamed to language as pandoc

question: this affects pandoc v1 and v2 ?

Just to share my preferences I like the format iso 8601 YYYY-MM-DD

ysndr commented 5 years ago

The internal localization is of strings in pandoc is handled here and expects a BCP47 identifier behind the lang meta attribute.

I use the non standard language tag to set the polyglossia language manually. Yet looking at pandoc source code setting the polyglossia language manually shouldn't be necessary as done internally already. I will look into this again.

Just to share my preferences I like the format iso 8601 YYYY-MM-DD

What do you mean by that?

pedro-nonfree commented 5 years ago

given here says proper date format

Just to share my preferences I like the format iso 8601 YYYY-MM-DD

What do you mean by that?

I mean that if I set my language format my date format is not going to behave as I want (iso 8601 YYYY-MM-DD)

That's how I solved it in my own version https://gitlab.com/pedrolab/invoice-boilerplate/blob/master/template.tex#L97-99 -> the thing is: I don't know if I can handle this with pandoc more transparently

ysndr commented 5 years ago

With date format, the locale specific date format is meant eg. 11/25/18 is printed for en-US in contrast to 25.11.2018 for European locales (don't take theese examples too literally, I couldn't write a paper example in code atm)

For date formatting the isodate packege is currently used. Additionally the date is hardcoded to be numeric but I could add support for specifying the isodate style in the config.

The language selection can also be changed I learned as pandoc provides converted language versions for polyglossia and babel

ysndr commented 5 years ago

the template now uses datetime2 for printing dates the config can have a datetime2 key which content is inserted as package options for datetime 2 additionally a datestyle key was added to allow quick change of date formats defined by datetime2 (see its manual for more info)

a \date{<iso>} command was added to be used in texts to print dates according to the current regional preferences (again see datetime2 manual \DTMdate{...}