question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getAvailableLocaleCodes not refreshing when new locales are fetched dynamically

See original GitHub issue

In our code we fetch new locales dynamically and then eval them. This seems to work fine, that is, the calendar uses the new locale just fine when we do calendar.setOption('locale', locale). However, calendar.getAvailableLocaleCodes() returns only the ones that were available when the calendar was created and doesn’t reflect the newly added ones. In version 3 we did the same with $.fullCalendar.locales and it did refresh when we evaled new locales.

P.S. Another thing is that the firstDay doesn’t change when calendar.setOption('locale', locale) is invoked. It only dynamically changes when a new calendar is created. Should I open a new issue for that?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
acerixcommented, Aug 1, 2019

Loading locales after the calendar was initialized wasn’t documented in v3 so I think it’s not really a regression but I can leave this open as a feature request.

0reactions
boris-petrovcommented, Jul 3, 2020

@arshaw - well, this issue is even worse in FullCalendar version 5. The locales there are not browserified and one cannot simply import them dynamically in a website:

var enGb = {
  code: "en-gb",
  week: {
    dow: 1, // Monday is the first day of the week.
    doy: 4  // The week that contains Jan 4th is the first week of the year.
  }
};

export default enGb;

I have configured my bundler to copy these locales to my distribution and then I have setup code to dynamically load locales as requested by the user - in order to not download to that user all locales upfront.

In version 4 that worked fine because the locale files were browserified. But then getAvailableLocaleCodes didn’t “refresh” when a new locale was added - I had to create a new Calendar instance for it to work.

In version 5 I have to manually “fix” the locale files to work in a browser. And I removed my workarounds with creating a new Calendar instance and all that.

So the issue can be closed, yes, even though the underlying problem is still there albeit not relevant any more to me.

Thanks for the support!

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - Why some locales are not working even if available?
I know that the localization depends on the locales available on the JRE, my app is currently running in a Docker container where...
Read more >
Need help designing some JUnit tests - Google Groups
Your current JVM doesn't have new Locales, so writing for ones that don't exist is clearly not possible. However, you can use
Read more >
Locale getAvailableLocales() Method in Java with Examples
Return Value: This method returns the array collection of all the installed locales. Below program illustrates the working of ...
Read more >
A Beginner's Guide to Internationalization in Java | Phrase
Compound messages have constituents that need to be translated into locale-specific code, and cannot be handled by resource bundles alone.
Read more >
Advanced Features: Internationalized Routing - Next.js
The default locale does not have a prefix. Domain Routing. By using domain routing you can configure locales to be served from different ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found