Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for bundling locales #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Support for bundling locales #2

wants to merge 1 commit into from

Conversation

klocatelli
Copy link

Optimizing with r.js doesn't inline locales unless they're specifically required. This is an inconvenience when using almond.js and/or a small set of translations.

Attached commit should fix that. Requires a new inlining flag to be set and true in order to run the "inline everything" process, otherwise does the same thing as before.

@jbaylina
Copy link

I created a fork precissely to do that. With this change, the "locale" parameter in the config file accepts an array of locales. If that is the case, all the locales in the array are included in the bundle.

@sergiofbsilva
Copy link

I've defined nls/messages.js

define({
    "root": {
        'Persons':'Persons List'
    },
    "pt-pt": true
});

and nls/pt-pt/messages.js

define({
    'Persons':'Lista de Pessoas'
}); 

my build.js for r.js includes

locale:"pt-pt"

In defines and requires I only use i18n!nls/messages and nls/pt-pt/messages.js don't get included in the minification.

Is this normal behaviour ? I was expecting that defining locale:"pt-pt" in the build.js file should be enough for including the nls/pt-pt/messages.js but it doesn't.

I will try your fork to see if it works then, thank you!

@ZhenguoYang
Copy link

@sergiofbsilva

I encountered, is there any solution?

@daniel-white
Copy link

👍 i would be for this. i defined a custom module in my r.js config and the plugin still loads it from the unbundled location.

@hnqso
Copy link

hnqso commented Jul 16, 2014

Any updates on that? Does someone found a solution? @daniel-white can you share your custom module, your work around please? :)

@daniel-white
Copy link

@henriquea i don't have a workaround at this time. my custom module is just a load layer that my build scripts used.

@hnqso
Copy link

hnqso commented Jul 16, 2014

@daniel-white thanks mate. In the end I had to remove this from my project and I'm using one single module with all the locales. It's a shame, I'll follow this thread to see what happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants