Using Translation Features in Your Widget

By default, the Liferay JS Generator creates an empty configuration for translation. The translate script instructs the user how to add new supported locales or configure the credentials when it is run. The translate target reads the supported locales you have defined in the supportedLocales key of your .npmbuildrc file and checks your *language.properties files to make sure they match.

Follow these steps to add a new supported locale and automatically create a language properties file for it with translations:

  1. Add the locale to the supportedLocales array in your .npmbuildrc file.

  2. Run the translate target with the command below:

    npm run translate
    
  3. The translate target automatically creates a language properties file for each new supported locale with translations for your language keys. It also warns about locales that are not supported, but have a *language.properties file.

Great! Now you know how to use the Liferay JS Generator’s translation features in your app.

« Configuring Portlet Properties for Your JS WidgetIntroduction to Front-End Taglibs »
この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています