argenos / nldates-obsidian

Work with dates in natural language in Obsidian
MIT License
477 stars 43 forks source link

Multilanguage support #19

Open paolo-santucci opened 3 years ago

paolo-santucci commented 3 years ago

Hi, love your plugin. Do you plan to offer multilanguage support? I'd be happy to provide the translated strings for Italian.

argenos commented 3 years ago

It's not something I can prioritize right now, as I don't have the time nor the knowledge of other languages to make it work, but I'm willing to accept PRs if anyone wants to tackle this.

Whether it's actually possible, depends on what you mean by multi-language support:

argenos commented 3 years ago

See also #13

RensOliemans commented 2 years ago

I would like to pick this up - depending on the scope and refactoring necessary. It seems chrono has support for 6 languages (docs):

Fixing the parsing for languages other than en is quite easy (I have that on a local branch right now), but that leaves you with the parser parsing a different languages than the suggestions (because the suggestions are hard-coded English), which is very unintuitive.

To fix it properly with suggestions (in the dropdown) and custom parsing options (next week, etc) requires quite some refactoring, and I'm not sure how we want the code to be at the end. One idea is to extract the English suggestions from the logic, so that future PRs can easily add a new language by adding the translations of month/week/Sunday/x days ago/Today/etc. What are your thoughts on this?

This would still take quite some time, though, since we need to refactor large parts of parser.ts and date-suggest.ts.

RensOliemans commented 2 years ago

Easier solution: do everything with i18n. Then create language files that people can extend for their own languages (supported by chrono). I'm working on that, but not used to rollup so still having some trouble getting i18n included in the build (Obsidian says Plugin failure: nldates-obsidian Error: Cannot find module 'i18n')

RensOliemans commented 2 years ago

@argenos I merged master back into multilanguage, the PR is now updated. I've been building (from multilanguage) and using the plugin locally for some time and tested the changes manually, it works as expected.

If anyone else wants to test these changes for themselves (you'll have to build the plugin locally), take a quick look at the readme of this branch. Note that Only Dutch and English are supported fully as of now, for French/German/Japanese/Portuguese only "today", "tomorrow" and "yesterday" work.

jaffall commented 2 years ago

This is a great plugin. I teach french speaking college students how to use Obsidian to keep track of notes and assignments. So I second wholeheartedly multi language support. More specifically french. Hope this gets picked up.

RodWarrior commented 2 years ago

I really want Pt-BR! I can help translate strings, no problem. I can't code, but can help translating.