Add new macro importing translation to the final binary #12

Merged
kiwii merged 2 commits from plume/rocket_i18n:master into master 3 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 3 years ago
/// ```
#[macro_export]
macro_rules! include_i18n {
( $domain:tt, [$($lang:tt),*] ) => {
elegaanz (Migrated from github.com) commented 3 years ago
Owner

Is a string literal a single tt?

Is a string literal a single `tt`?
elegaanz (Migrated from github.com) reviewed 3 years ago
/// ```
#[macro_export]
macro_rules! include_i18n {
( $domain:tt, [$($lang:tt),*] ) => {
elegaanz (Migrated from github.com) commented 3 years ago
Owner

I just tested it, and it works. 👌

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

Thanks!

trinity-1686a reviewed 3 years ago
/// ```
#[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.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.