Add new macro importing translation to the final binary #12

Merged
kiwii merged 2 commits from plume/rocket_i18n:master into master 5 years ago
Owner

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 5 years ago
@ -127,0 +135,4 @@
/// ```
#[macro_export]
macro_rules! include_i18n {
( $domain:tt, [$($lang:tt),*] ) => {
elegaanz (Migrated from github.com) commented 5 years ago

Is a string literal a single tt?

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

I just tested it, and it works. 👌

I just tested it, and it works. :ok_hand:
elegaanz (Migrated from github.com) approved these changes 5 years ago
elegaanz (Migrated from github.com) left a comment

Thanks!

Thanks!
trinity-1686a reviewed 5 years ago
@ -127,0 +135,4 @@
/// ```
#[macro_export]
macro_rules! include_i18n {
( $domain:tt, [$($lang:tt),*] ) => {
Poster
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

Reviewers

The pull request has been merged as 7a397ffdfe.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b master master
git pull origin master

Step 2:

Merge the changes and update on Forgejo.
git checkout master
git merge --no-ff master
git push origin master
Sign in to join this conversation.
No reviewers
No Milestone
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
Loading…
There is no content yet.