jskherman / imprecv

A no-frills curriculum vitae (CV) template using Typst and YAML to version control CV data.
Apache License 2.0
330 stars 42 forks source link

Multilingual setup #11

Open xplosionmind opened 9 months ago

xplosionmind commented 9 months ago

Hi! First of all, allow me to thank you for creating this wonderful template, it is really cool!

I would be super interested in having a unified and consistent system to have the YAML data and the CV compiled both in English and other language(s).

I would be very happy to contribute to the project, but I would need some guidance. Could you give me some suggestions about the first steps to achieve this?

Thanks a lot!

jskherman commented 9 months ago

Thank you. As for multilingual support, there's a fork by jmml97 that changes the language of this template to Spanish with code es.

One way that could be done is to define the language in a lang field within the uservars variable. This should follow the format of ISO 639-1/2/3. This lang value can then be passed to a show rule and used to set the lang parameter for the text function for the entire template, as per the docs.

Next, using the same lang value, we can create a function that sets variables containing the strings for specific parts of the template, such as txt.education, txt.experience, txt.awards, and so on. Instead of hardcoding these strings in the template, we can use these variables.

The source for these text variables could be a dictionary of arrays that contains the strings, organized by ISO 639-1/2/3 language code. Alternatively, for simplicity, this data could be stored in a JSON or YAML file instead.

Edit: I forgot to mention the dates. I'm not sure if Typst automatically changes the strings output by the display() method for datetime types to be same as the language set in the text() function. Probably not. Since the template uses this method, this is another issue to look out for.