Skip to content
This repository has been archived by the owner on May 6, 2021. It is now read-only.

Localization documentation issues #1265

Open
mvysny opened this issue May 20, 2020 · 1 comment
Open

Localization documentation issues #1265

mvysny opened this issue May 20, 2020 · 1 comment

Comments

@mvysny
Copy link
Member

mvysny commented May 20, 2020

https://vaadin.com/docs/v14/flow/advanced/tutorial-i18n-localization.html

  1. The LocaleObserver and MyLocale example is completely artificial. You don't set texts in your apps by creating subclass of Div for every text you wish to localize! You usually use textField.setLabel()
  2. Best practices missing. Should I use LocaleChangeObserver or not?
  3. Consistent overall strategy missing. Should my components respond to locale changes in UI.getCurrent() or not? If yes, then the view needs to implement LocaleChangeObserver and modify all labels, which is quite a lot of work, so probably this should be discouraged. Also it works really poorly with DatePicker since it doesn't respond to locale changes in UI.getCurrent() as seen at https://github.com/vaadin/vaadin-date-picker-flow/issues/253 . Probably a better idea is to suggest the programmer to perform page reload when UI locale changes. However, that makes LocaleChangeObserver obsolete.
  4. Example missing on how to get timezone from the browser (Page.retrieveExtendedClientDetails()).
  5. Best practice missing on how to apply timezone to every DateTimePicker constructed; that the timezone should be initially detected from the browser but the user might want to change that in the app's user settings.
  6. That you should call VaadinSession.setLocale() instead of UI.setLocale().
@thigg
Copy link
Contributor

thigg commented Jul 11, 2020

  1. Example missing on how to use translations from a non-ui class, e.g. a controller.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants