Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for translations #3

Open
notramo opened this issue Dec 16, 2017 · 13 comments
Open

Add support for translations #3

notramo opened this issue Dec 16, 2017 · 13 comments

Comments

@notramo
Copy link

notramo commented Dec 16, 2017

No description provided.

@vi
Copy link
Owner

vi commented Dec 16, 2017

Of the long format or also for short as well?

How are translations in general handled in Rust world? Is there some sample library crate where translations are implemented?

@hoodie
Copy link

hoodie commented Dec 17, 2017

There is a crate called crowbook-intl. If any body knows another I'd be interested

@vi vi mentioned this issue Feb 4, 2018
@notramo
Copy link
Author

notramo commented Feb 5, 2018

I'm not familiar with Rust, but I think translations should be hardcoded, because these are short words that won't likely change, so it don't need a transation system that tracks the changes of the original text.
In some languages, the text needs to be changed according to the number: 1 day or 2 days, but in other languages, it don't. Also, in some languages there are special phrases for describing time durations, that are shorter than the loan translation of e.g. '%s days ago'. For example, in Hungarian, the loan translation of '2 days ago' is '2 nappal ezelőtt', which is a quite long, but there is an inflection of the 'day' ('nap') word that is the same: '2 napja'.

@vi
Copy link
Owner

vi commented Feb 5, 2018

Shall it allow to choose the language from enum (populated only with English initially) and allow to opt-in more hard coded translations using Cargo features?

@vi
Copy link
Owner

vi commented Feb 5, 2018

Is there maybe a crate with authoritative list of languages for localisation as an enum, but which does not enforce any particular scheme?

@notramo
Copy link
Author

notramo commented Feb 5, 2018

I think it don't need to be opt-in.
I meant hardcoded text that it should be implemented in Rust code instead of external solutions (YAML, .po files), because it is more flexible. All languages should be available at runtime, no need for Cargo features.

@vi
Copy link
Owner

vi commented Feb 7, 2018

Please review the proposed API for translation and additional features: https://github.com/vi/timeago/blob/3656ed710edacd13699d147ef6d3dc9ab694dee8/src/lib.rs

Is it going to the right direction?

@hoodie
Copy link

hoodie commented Feb 7, 2018

@vi have you looked at crowbook-intl?

@vi
Copy link
Owner

vi commented Feb 7, 2018

I've glanced there once, saw tricky build script and macros and looked away.

Is the way there a good way do to translations? Can it be opt-in (preserving simplicity for ones who don't care about translations)?

@vi
Copy link
Owner

vi commented Mar 26, 2018

Added some support for translations (without build scripts or macros, but with isolangs interface) in version 0.1.1.

Is it the translation support you expect?

I don't think formatting time intervals is to be done by some framework with loadable files. Each language can contain tricks to algotithms.

Currently only provided translations for languages that I personally know/learned.

@joseluis
Copy link
Contributor

joseluis commented Apr 8, 2019

@vi
Copy link
Owner

vi commented Apr 8, 2019

@joseluis , How do you expect timeago and fluent to interact? Using fluent's functions?

@joseluis
Copy link
Contributor

joseluis commented Apr 8, 2019

@vi Oh, easy. This is the rust crate https://crates.io/crates/fluent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants