I18n #60

Merge aplicado
elegaanz mesclou 23 commits de i18n em master 2018-06-17 16:59:03 +00:00
elegaanz comentou 2018-06-17 10:25:49 +00:00 (Migrado de github.com)

Here is the workflow I came with:

  • When we want to add a new locale, just list it in po/LINGUAS
  • When we want to translate something:
    • Use the _ or _n filters in the Tera template
    • Add the corresponding string to po/plume.pot
  • Then when you run cargo build (or cargo run), it:
    • Updates your translation files (.po ones) with new strings, or create them from the POT if they don't exist
    • Compile them to .mo files
  • On the Rocket side:
    • When launching, tell gettext where our .mo files are
    • For each request, fetch the requested locale from the Accept-Language header, and tell gettext to use it (with a dirty hack)

TODO:

  • Make the interface actually translatable (by replacing untranslatable strings with calls to _ and _n)
  • Write an internationalization guide
  • Compile translation when launching instead of at compile-time, to avoid useless builds (and make it easier to integrate with other projects in the future)
  • Put the i18n module in its own crate?

Fixes #58

Here is the workflow I came with: - When we want to add a new locale, just list it in `po/LINGUAS` - When we want to translate something: - Use the `_` or `_n` filters in the Tera template - Add the corresponding string to `po/plume.pot` - Then when you run `cargo build` (or `cargo run`), it: - Updates your translation files (`.po` ones) with new strings, or create them from the POT if they don't exist - Compile them to `.mo` files - On the Rocket side: - When launching, tell gettext where our `.mo` files are - For each request, fetch the requested locale from the `Accept-Language` header, and tell gettext to use it (with a dirty hack) TODO: - [x] Make the interface actually translatable (by replacing untranslatable strings with calls to `_` and `_n`) - [x] Write an internationalization guide - [x] Compile translation when launching instead of at compile-time, to avoid useless builds (and make it easier to integrate with other projects in the future) - [x] Put the `i18n` module in its own crate? Fixes #58
elegaanz comentou 2018-06-17 14:10:32 +00:00 (Migrado de github.com)

I made a crate for this, so that other Rocket-based projects can re-use it: https://crates.io/crates/rocket_i18n

I made a crate for this, so that other Rocket-based projects can re-use it: https://crates.io/crates/rocket_i18n
elegaanz comentou 2018-06-17 14:25:08 +00:00 (Migrado de github.com)

OK, I can't use the crate because we need to depend on Rocket master and crates.io won't let us do that.

Edit: actually, I can may use the git repository as a source

OK, I can't use the crate because we need to depend on Rocket `master` and crates.io won't let us do that. Edit: actually, I can may use the git repository as a source
trinity-1686a revisou 2018-06-17 15:28:59 +00:00
@ -6,9 +6,9 @@
{% endblock title %}
Proprietário(a)

I think a | _ is missing here

I think a `| _` is missing here
Proprietário(a)

In-code strings like 5ae9cb3490/src/routes/blogs.rs (L59) are missing.
Adding translation by modifying only utils::requires_login, not each route files, seems to be the way

In-code strings like https://github.com/Plume-org/Plume/blob/5ae9cb3490a40b3e48b53b56d212035bc26695cc/src/routes/blogs.rs#L59 are missing. Adding translation by modifying only utils::requires_login, not each route files, seems to be the way
Inicie a sessão para participar desta conversa.
Sem revisor
Sem marco
Sem projeto
Sem responsáveis
2 participantes
Notificações
Data limite
A data limite é inválida ou está fora do intervalo permitido. Por favor, use o formato "yyyy-mm-dd".

Não há data limite definida.

Dependências

Não há dependências definidas.

Referência: Plume/Plume#60
Nenhuma descrição fornecida.