flow-and-components-documentation icon indicating copy to clipboard operation
flow-and-components-documentation copied to clipboard

Localization documentation issues

Open mvysny opened this issue 5 years ago • 1 comments

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().

mvysny avatar May 20 '20 05:05 mvysny

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

thigg avatar Jul 11 '20 09:07 thigg