globalizejs / globalize-compiler

Globalize.js runtime compiler for your formatters and parsers
Other
10 stars 14 forks source link

What if I use Babel and wrappers around Globalize module? #4

Closed SleepWalker closed 8 years ago

SleepWalker commented 8 years ago

Hello,

I use the following function to get translations:

import Globalize from 'globalize';
export function t(category, key, ...params) {
    return Globalize.formatMessage(category + '/' + key, ...params);
}

Here I have the following issues:

Is there any workaround or it is impossible to get compiler working?

rxaviers commented 8 years ago

Your approach is non-deterministic for the compiler, more details can be found in this analogous question https://github.com/jquery-support/globalize-compiler/issues/10#issuecomment-173571256.

Having said that, one approach is writing your own compiler that would look for the t function in your code and call globalize-compiler with appropriate code. rxaviers/react-globalize-webpack-plugin could be used as baseline.

I'm closing your issue given the above reply, but feel free to include additional comments if you have any further questions.