feat: Multilingual YAML file #271
Replies: 23 comments
|
Hello, thanks for raising this. My understanding, you want something like this: content:
basics:
name: Andy Dufresne
headline:
en: Headed for the Pacific
fr: En route vers le Pacifique
phone: "(213) 555-9876"
email: hi@ppresume.comFor fields that has potential translations ( This is doable but with very high pricing:
With all above concerns, I would highly not like to implement this feature unless there are some simple ways for the implementation. To solve your issue, I can think about two ways:
i.e: The yamlresume file content:
basics:
name: Andy Dufresne
headline: t('basics.headline')
phone: "(213) 555-9876"
email: hi@ppresume.comen translations {
"basics.headline": "Headed for the Pacific"
}fr translations 'fr.json': {
"basics.headline": "En route vers le Pacifique"
}Then use some script to deal with Thoughts? |
|
Hi! Yes, that's exactly what I had in mind. Some thoughts:
The way to do this in the JSON scheme, as far as I can tell, would be to have every value be either of type As far as regards the proposed solution,
This suggestions is a fairly niche use-case, so I don't think you should bloat your code just to implement it, but if there is a way to implement it efficiently then I think it could prove very useful to a small minority of users. |
|
I would also be interested in multilingual support. |
|
In my opinion being able to implement something like the proposed:
Seems like the perfect solution: Does not break compatibility and does not bloat the resumees while still providing multilingual support. |
|
JSON schema support the But still this will make it hard to revise the And content:
basics:
name: Andy Dufresne
headline:
multi:
en: Headed for the Pacific
phone:
multi:
en: "(213) 555-9876"
fr: "+1 213 555 98 76"
email: hi@ppresume.comSounds like a good approach because it makes thing more explicit. Any way for me I still prefer to keep the the core lib of YAMLResume simple, and I am a bit hesitated to add multi languages support as we discussed here to YAMLResume core lib now, in my preference, YAMLResume should provide a solid, simple foundational design/lib, while multi languages should be lifted to upper, "application" level. I will pin this issue for a while and see if there are more people voting here. |
|
Leaving the issue open to see what prople think sounds like a good idea. Just a clarification — why do you say that |
YAMLResume by default support terms and idioms translations, for example,
If support multilingual resumes in one YAML file, then yamlresum needs to know: "what is the target list of langauges in this YAML file to compile to when call Hence we need to explicitly specify the target language as a list in |
It is totally reasonable to keep it simple, but in my case, I am looking for a way to have everything in one place |
Perhaps we are not talking about the same thing — in what I suggest, the compiled CV is never multilingual. There is only ever one output language at a time. What is multilingual is the YAML file. As @AleixMT points out, this is just a way to keep user-written translations together. |
Hey, let us say that you have a resume as proposed like this: content:
basics:
name: Andy Dufresne
headline:
multi:
en: Headed for the Pacific
fr: En route vers le Pacifique
phone:
multi:
en: "(213) 555-9876"
fr: "+1 213 555 98 76"
email: hi@ppresume.com
locale:
language: frIf Then how would you get the English version of the resume? Manually modify What I suggest: content:
basics:
name: Andy Dufresne
headline:
multi:
en: Headed for the Pacific
fr: En route vers le Pacifique
phone:
multi:
en: "(213) 555-9876"
fr: "+1 213 555 98 76"
email: hi@ppresume.com
locale:
language:
- en
- frHere |
|
I see your point, but I actually had in mind that the user would change If the user compiles this, they get the French version. To get the English version, they change to and rebuild. I feel like this generates less clutter than having the software generate multiple PDFs every time. It also means that if a user adds an Only if the user wants to actually generate the |
A tiny issue for this approach is, users need to rename the output in order to avoid conflict/override when switching languages. For a resume If you forget to rename the output filename, and when you switch the language, the generated output would be overriden. That is another reason of why I propose to support a list of languages in |
|
I think this is a matter of preference — after all, the output already gets overwritten very time you change the YAML file. Following the philosophy that the YAML source file is the actual CV from which you generate PDF/HTML/... representations, I suspect that users won't mind that the PDF file changes. (Even if you're using git, you're not tracking the PDF file as it's a binary file...) Speaking for myself, my current set-up — which is a pandoc-based thing I cobbled together with a filter for the multilingual YAML file — overwrites the PDF file every time. Generating more files than the specific PDF file I need would just be clutter. |
Yes yes, I understand your point. My point here is more about users' expectations and the semantics, i.e, if multilingual resume is supported, then generated multiple resumes in different languages in one shot should also be an expected behaviour in my opinion. Anyway, let's see any others interested here. |
|
My personal preference would be to be able to write my resume in a single big file, with all the translations in the same place and locale as an array of preferred languages content:
basics:
name:
fr: André Vicomte du Fresne # let's say They are legally obligated to disclose their nobility since the french revolution
en: Andy Dufresne # Internationnaly they prefer to keep it casual
headline:
fr: En route vers le Pacifique
en: Headed for the Pacific
es: Vamos a la playa
phone:
en: "(213) 555-9876"
fr: "+1 213 555 98 76"
email: hi@ppresume.com
locale:
language:
- fr
- en
- esWhich, would generate 3 resume in one shot
You'd end up with files generated as if they'd have had resulted from the 3 following yaml : content:
basics:
name: André Vicomte du Fresne
headline: En route vers le Pacifique
phone: "+1 213 555 98 76"
email: hi@ppresume.com
locale:
language:
- fr🇬🇧 content:
basics:
name: Andy Dufresne
headline: Headed for the Pacific
phone: "(213) 555-9876"
email: hi@ppresume.com
locale:
language:
- en🇪🇸 Warning Some fields are translated but the appropriate translation could not be found for current locale content:
basics:
name: André Vicomte du Fresne # We use nobility title since Spain's king agnatically descends from former french king Louis XIV ... (guillotine intensifies)
headline: Vamos a la playa
phone: "+1 213 555 98 76"
email: hi@ppresume.com
locale:
language:
- esThis is what would work best for me. (extra nice bonus would be if I could specify for which locale I want to generate files when sometimes I'd like to generate only a specific one withe something like |
|
hey @gulhe your proposal is a pretty nice design. I may implement this after the first stable release of v1.0, but before v1.0, I would like to implement other high priority features like typst engine, gallery package, etc. |
|
Thanks for the compliment
Sure ! Those features seem awesome. Keep up the cool work and thank you very much for it ! I'm in no rush anyway I just wanted to contribute how this specific feature could make sense for my lazy brain 😉 |
|
I implemented this in #222 but I implemented other features and I need to split them in smaller PRs to merge them. If someone is really interested can take the work from this point. I will do it when I have time, but I am not sure when that will be. |
|
OK I found that somebody use his own way to support multi-language translations: https://github.com/brenopolanski/brenopolanski.com/blob/dev/resume/translations.pt-BR.yml Interesting. |
Huh. Interesting method, but it seems to me that changing the English-language string requires changing it in at least two places... |
yep that is right. BTW, just got a new v0.16.0 release: https://github.com/yamlresume/yamlresume/releases/tag/v0.16.0, which started to provide an |
Hey @xiaohanyu, You are right that I solved multilingual support outside the core. I wanted to leave a few technical notes on why, and on gulh's proposal, which I think is the right long-term shape if this ever lands in the library. What I built
Wording lives in a separate translation memory: The memory is closer to gettext than to strings:
'Software Engineer': 'Software Engineer' # keep as-is
'Systems Analyst': 'Analista de Sistemas'
'Bronze Medal': 'Medalha de Bronze'A small generator walks a known set of translatable fields ( Two guards keep the languages from drifting:
I deliberately do not translate company names, product names, technology tokens, or URLs. Those stay English in both PDFs. Why this shape, and why not inline locales@xiaohanyu's earlier comment in this thread is exactly why I stayed at the application layer:
Keeping The tradeoff @tytyvillus pointed out is real: if I rephrase an English bullet, I must also rename the key in
Why I like gulh's YAMLIf this is going to live in YAMLResume itself, I would rather see gulh's model than either my glossary or content:
basics:
name:
fr: André Vicomte du Fresne
en: Andy Dufresne
headline:
fr: En route vers le Pacifique
en: Headed for the Pacific
es: Vamos a la playa
phone:
en: "(213) 555-9876"
fr: "+1 213 555 98 76"
email: hi@ppresume.com
locale:
language:
- fr
- en
- esWhat I like, concretely:
A resolution rule I would add, from running this in production:
That last point is why I never put Schema, without bloating the public typesI agree the public JSON Schema should stay simple. A preprocess step is enough:
Users who never use maps never see the feature. The published schema for the resolved document does not change. The multilingual file can be a thin "source schema” ( I would not require a What I would not put in coreLLM sync between two YAML files, and If gulh's design lands after v1.0, I would migrate to it and delete the glossary. Until then, keeping the core a single-locale Happy to answer anything about the generator or the pt-BR constraints if it helps the design. |
|
@brenopolanski very very insightful response and solution. Thank you! I feel that we almost aligned with @gulhe approach for multilingual YAMLResume. I will implement this accordingly after v1.0. |
Uh oh!
There was an error while loading. Please reload this page.
Description
Currently, it's possible to localise a CV by specifying a language in the
localeheading. This is great! But if I want to translate my CV to, say, French, I have to create an entirely seperate YAML file with all the text content translated to French. This becomes annoying once I need to maintain two separate versions of my CV in two different files, and need to go hunt down the correct entry in both if I want to update it.Possible Solution
A way around this is to allow users to specify different localisation strings for entries using ISO codes. An example of how this might be implemented is the
pandoc-localise-yamlfilter (full disclosure: written by me), which does it for Pandoc.Perhaps this is a bit of a niche case, but I can imagine it being useful for at least some users.
Acceptance Criteria
Users should be able to specify several strings for an entry, which can be automatically selected based on the language locale.
To-do list
All reactions