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

Little answer #76

Open
Gromov-Roman opened this issue Mar 3, 2017 · 2 comments
Open

Little answer #76

Gromov-Roman opened this issue Mar 3, 2017 · 2 comments

Comments

@Gromov-Roman
Copy link

Good day!

How can I announce language and json files in one main html, and use just {{locale('something')}} or some any function in all my html files?

Many thanks for your attention!

@hyyan
Copy link

hyyan commented Mar 3, 2017

@kaycebasques It is already explained in the README file

<dom-module id="x-app">
   <template>
    <div>{{localize('hello', 'name', 'Batman')}}</div>
   </template>
   <script>
      Polymer({
        is: "x-app",

        behaviors: [
          Polymer.AppLocalizeBehavior
        ],

        properties: {
          language: {
            value: 'en'
          },
          resources: {
            value: function() {
              return {
                'en': { 'hello': 'My name is {name}.' },
                'fr': { 'hello': 'Je m\'apelle {name}.' }
              }
          }
        }
      });
   &lt;/script>
</dom-module>

@Gromov-Roman
Copy link
Author

Gromov-Roman commented Mar 6, 2017

It is for one file, I must use

behaviors: [ Polymer.AppLocalizeBehavior ],
properties: {
   language: {  value: 'en'  },
   resources: {
      value: function() {
         return {
           'en': { 'hello': 'My name is {name}.' },
           'fr': { 'hello': 'Je m\'apelle {name}.' }
         }
     }
  }
}

in any file?

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

No branches or pull requests

2 participants