cargo-i18n icon indicating copy to clipboard operation
cargo-i18n copied to clipboard

Consider a code generation type safe version of i18n-embed-fl

Open kellpossible opened this issue 4 years ago • 3 comments

The https://github.com/baptiste0928/rosetta project brings some interesting ideas, it generates code using the build.rs script that can be used to reference localizations using native Rust types which also integrates well with IDE autocomplete. In addition, the function signature for localizations with variables are also generated, making it very easy to use a given localization correctly without needing to reference the source file. Seems like it should be possible to do something similar with fluent.

kellpossible avatar Oct 24 '21 07:10 kellpossible

Perhaps this could be made into an optional feature/technique until it proves itself on some larger projects/examples.

kellpossible avatar Feb 19 '22 12:02 kellpossible

This may rely on some ideas in #31 to be completely valid.

i18n::SOME_KEY.fmt(loader, arg1, arg2);
i18n::SOME_KEY.ATTRIBUTE.fmt(loader);

This does however lose some of the readability of the named arguments in i18n-embed-fl implementation.

kellpossible avatar Jan 10 '23 00:01 kellpossible