Skip to content
Permalink
Browse files

doc: Better documentation for example

  • Loading branch information...
MikeMitterer committed Nov 13, 2018
1 parent 8d99696 commit 1d30157b68f8cc5cad8f511161c22e991b0b8b11
Showing with 5 additions and 0 deletions.
  1. +2 −0 README.md
  2. +3 −0 samples/browser/web/main.dart
@@ -48,6 +48,8 @@ void main() async {
() => findSystemLocale(),
(final String locale) => initializeMessages(locale)
);
// Set "lang" in the DOM
(dom.querySelector("head") as dom.HeadElement).lang = locale;
// App specific code
// ...
@@ -8,11 +8,14 @@ import 'package:l10n/l10n.dart';
import 'package:browser_example/_l10n/messages_all.dart';

Future main() async {
// initLanguageSettings checks the browser url if it finds
// a "lang" query param and sets the locale accordingly
final String locale = await initLanguageSettings(
() => findSystemLocale(),
(final String locale) => initializeMessages(locale)
);

// Set "lang" in the DOM
(dom.querySelector("head") as dom.HeadElement).lang = locale;

dom.querySelectorAll('.translate')

0 comments on commit 1d30157

Please sign in to comment.
You can’t perform that action at this time.