【问题标题】:How to apply i18n on console message under Aurelia如何在 Aurelia 下的控制台消息上应用 i18n
【发布时间】:2019-03-23 14:57:32
【问题描述】:

我在 Aurelia Framework 下工作。我想在控制台消息上应用 i18N。 我使用两种语言“英语”和“法语”

Console.log("Hello World");

如果用户更改语言模式,我如何以法语打印此消息。

【问题讨论】:

    标签: internationalization aurelia


    【解决方案1】:

    docs for the plugin 确实包含该示例:

    import {I18N} from 'aurelia-i18n';
    
      export class MyDemoVM {
        static inject = [I18N];
        constructor(i18n) {
          this.i18n = i18n;
          console.log(this.i18n.tr('mykey'));
        }
        ...
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-07-08
      • 1970-01-01
      • 2017-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-14
      • 1970-01-01
      相关资源
      最近更新 更多