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

Using locales and translations #127

Closed
wants to merge 6 commits into from
Closed

Conversation

Luisetelo
Copy link

I've translated the entire component and now is both available in spanish and english. Here is a list of changes I've made:

  • The month day is presented in cardinal according to http://materializecss.com/forms.html
  • The first day of the week and day names in the calendar change according to the current locale
  • Added external translations for OK and Cancel buttons.

@joews
Copy link
Member

joews commented Feb 28, 2017

Hi, thanks for the PR! 👍

I don't want to include moment locales here, because many people would have to include code that they don't need in their app bundles.

You can import and use moment locales outside of the component itself - see #89 (comment) for an example with <script> tags. I am pretty sure it works the same with bundled modules.

Could you re-submit the PR without that import, and without the compiled files? I'll have time to review it later this week.

Thanks!

@Luisetelo
Copy link
Author

Honestly, I rule out the option of loading moment-with-locales.js for the same reason you mention. However, I didn't find a solution for loading locales dynamically.

I am using your package as part of a Ember component, so I am no able to write <script> tags. Usually material-datetime-picker is used like this:

    const picker = new MaterialDateTimePicker({
      format: 'DD/MM/YYYY HH:mm',
    });

Is there any other way of loading the locales for your package?

CRAZY IDEA: What do you think of receiving the moment object from outside? I use one throughout my code with all the locales that I need...

@Luisetelo
Copy link
Author

Closing this PR. I will submit a new PR with an improved version :)

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.

2 participants