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

Implement support for TimeZone information + General enhancements #11

Closed
wants to merge 42 commits into from

Conversation

arjanmels
Copy link
Collaborator

  • Add support for Timezones
  • Included all locales that are available from CLDR
  • Changed includes to improve compile times when only limited number of locales is used (breaking change)
  • Improved documentation

Arjan Mels added 30 commits August 17, 2024 14:04
Corrected Language to Locale
@xvrh
Copy link
Owner

xvrh commented Sep 8, 2024

Thanks a lot. It looks great 👍

The only small thing I'm not 100% sure is the "common_locale_data_all.dart" library. I would not have bothered with that and the explanation around it. But if you think it's useful to you, then why not.

@xvrh
Copy link
Owner

xvrh commented Sep 8, 2024

Also, I think CommonLocaleData.en reads better than CommonLocaleDataEn(). I hope that with static extension method we could be able to add back the en getter with the separate imports.

Maybe we could make CommonLocaleData a globale variable and use normal extension method on them.

class CommonLocaleDataHolder {
}

final CommonLocaleData = CommonLocaleDataHolder();

// in en.dart
extension CommonLocaleDataEnExtension on CommonLocaleDataHolder {
  CommonLocaleData get en => CommonLocaleDataEn();
}

That way, we have the CommonLocaleData.en available only when we import the "en.dart" file.

Not the most beautiful. Maybe we could repurpose the cld variable for that (e.g. cld.en).

@arjanmels
Copy link
Collaborator Author

Thanks a lot. It looks great 👍

The only small thing I'm not 100% sure is the "common_locale_data_all.dart" library. I would not have bothered with that and the explanation around it. But if you think it's useful to you, then why not.

Not very useful for myself, but a convenience if you want to include ALL locales dynamically (which will result in several 10MB file size).

@arjanmels
Copy link
Collaborator Author

Agree the previous syntax looked nicer. (Also minor niggle is that the CommonLocaleDataEn() will create a new object reach time: these objects are very small as most members are statics, but not 100% elegant.)

I'm not sure the extension methods will work with statics (you can only call them on the extension method name, not the original class name and you cannot have multiple extensions with the same name).

I haven't found a more elegant way that both keeps the tree shaking and good compile times.

Removed unused import from test
@arjanmels
Copy link
Collaborator Author

I fixed the dead code and unnecessary import warning that the build was failing on.

@arjanmels
Copy link
Collaborator Author

@xvrh Not sure if you got time to look at this pull request again? Are there further changes needed, to allow you to merge this change?

@xvrh
Copy link
Owner

xvrh commented Nov 21, 2024

Merged with #14

@xvrh xvrh closed this Nov 21, 2024
@arjanmels arjanmels deleted the timezones branch November 24, 2024 08:52
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