werner-scholtz / kalender

An elegantly crafted Flutter calendar UI package.
MIT License
107 stars 29 forks source link

Localization and directionality #92

Open MuKhAlm opened 1 month ago

MuKhAlm commented 1 month ago

Description

While the Widget does not work well with RTL Directionality, it also does not offer a way to translate CalendarComponents (week header and hours) to other languages.

Working with other languages/locale would allow for the wider use of the package.

Request

werner-scholtz commented 1 month ago

Hi thanks for the issue.

  1. Will work towards making RTL directionality work correctly, this will require some research into how rtl calendars work, I assume it is not as simple as just mirroring the calendar xD.
  2. In the latest version on branch pre-release-0.5.0 it will be possible to define custom string builders for all the default widgets, however adding locale support would be nice but not a priority at the moment.
MuKhAlm commented 1 month ago

RTL Directionality does seem tricky given that the calendar is not simple Columns and Rows.

After taking a quick glance of the code I noticed that it uses Positioned a lot. One potential way is to set the h-direction (left or right) to whatever the Directionality is.

Other Widgets respond automatically the moment the locale Direction changes.

When it comes to Localisation, it's actually not that hard to change Text (at least for WeekConfigurations) I simply copied the original builders and tweeked the Text values to use whatever my locale is.