Add new macro importing translation to the final binary #12

Merged
kiwii merged 2 commits from plume/rocket_i18n:master into master 2018-11-30 12:23:45 +00:00

Add a new macro include_i18n!, taking similar arguments to i18n(), and expanding to the same type. It allow to include translations in the final binary, so that once compiled, it can be run from anywhere,
without depending on .mos to be present

Add a new macro `include_i18n!`, taking similar arguments to `i18n()`, and expanding to the same type. It allow to include translations in the final binary, so that once compiled, it can be run from anywhere, without depending on `.mo`s to be present
elegaanz (Migrated from github.com) reviewed 2018-11-30 11:45:01 +00:00
@ -127,0 +135,4 @@
/// ```
#[macro_export]
macro_rules! include_i18n {
( $domain:tt, [$($lang:tt),*] ) => {
elegaanz (Migrated from github.com) commented 2018-11-30 11:45:01 +00:00

Is a string literal a single tt?

Is a string literal a single `tt`?
elegaanz (Migrated from github.com) reviewed 2018-11-30 12:23:25 +00:00
@ -127,0 +135,4 @@
/// ```
#[macro_export]
macro_rules! include_i18n {
( $domain:tt, [$($lang:tt),*] ) => {
elegaanz (Migrated from github.com) commented 2018-11-30 12:23:25 +00:00

I just tested it, and it works. 👌

I just tested it, and it works. :ok_hand:
elegaanz (Migrated from github.com) approved these changes 2018-11-30 12:23:36 +00:00
elegaanz (Migrated from github.com) left a comment

Thanks!

Thanks!
trinity-1686a reviewed 2018-11-30 12:57:02 +00:00
@ -127,0 +135,4 @@
/// ```
#[macro_export]
macro_rules! include_i18n {
( $domain:tt, [$($lang:tt),*] ) => {
Author
Owner

to be honest, I didn't know the type I needed to use, so I put the first one I thought of, and I tested if the macro worked as intended in Plume (which confirm Plume only needs that to become a standalone binary). It's totally possible provided with some bad arguments this macro fail in some strange way

to be honest, I didn't know the type I needed to use, so I put the first one I thought of, and I tested if the macro worked as intended in Plume (which confirm Plume only needs that to become a standalone binary). It's totally possible provided with some bad arguments this macro fail in some strange way
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: plume/rocket_i18n#12
No description provided.