JonasWanke / timetable

📅 Customizable flutter calendar widget including day and week views
https://pub.dev/packages/timetable
Apache License 2.0
310 stars 81 forks source link

How to change language/name for days #23

Open joj3000 opened 4 years ago

joj3000 commented 4 years ago

Hi,

How would you change the language/name for the days ? (I want to use the French names for the days).

I've tried many things :

Thanks, and again great package !

JonasWanke commented 4 years ago

time_machine is used internally for all date & time formatting. By default, it uses en_US as its locale (managed by the Culture class) and doesn't know about Flutter's locale. To change it to French, set Culture.current after the call to TimeMachine.initialize:

await TimeMachine.initialize({'rootBundle': rootBundle});
// Supported cultures: https://github.com/Dana-Ferguson/time_machine/tree/master/lib/data/cultures
Culture.current = await Cultures.getCulture('fr');
runApp(/* ... */);

There's an open issue for time_machine to provide a LocalizationsDelegate for easier integration: Dana-Ferguson/time_machine#28

joj3000 commented 4 years ago

Great, thank you very much !

JulianKowalczuk commented 4 years ago

@JonasWanke, could You put this info in readme? Some newbies won't dig in PRs to find out that and this is probably why flutter_week_view package is more popular, even I think Your one is better.

JonasWanke commented 4 years ago

@JulianKowalczuk Thanks! I've just published v0.2.5 and added a Localization section to the README.

I'll still leave this issue open as I want to simplify this soon.