Internationalizing a Polymer app
What if you want your web app to display information in several languages, depending on the language of the web client user? This recipe will show you how to accomplish this. You can find the code in the project pol_intl
.
How to do it...
- Add the
intl
package from the pub package to your app throughpubspec.yaml
. - The script starts with
web\pol_intl.html
, where a component with the namelocalized_text
is imported through the following line:<link rel="import"href="localized_text.html">
From this, we know that the component is defined in
localized_text.html
, and the code behind it is in a file namedlocalized_text.dart
. For a discussion of the other tags, see the first recipe. - The structure of the component is outlined in
localized_text.html
:<link rel="import"href="packages/polymer/polymer.html"> <polymer-element name="localized-text"> <template> <p>{{startMsg}}</p> <select...