Meteor accounts.ui localization

后端 未结 2 806
北恋
北恋 2021-02-07 16:30

I\'m learning to use meteor.

Is it possible to easily localize accounts.ui components?

相关标签:
2条回答
  • 2021-02-07 17:13

    Here is a trick I have used. Simple, but works:

    Template.header.rendered = function() {
      $('#login-sign-in-link').text('Přihlásit se ▾');
      $('.login-close-text').text('Zavřít nabídku');
      $('.sign-in-text-google').text('Přihlásit se přes Google');
      $('.sign-in-text-facebook').text('Přihlásit se přes FB');
      //etc...
    };
    
    0 讨论(0)
  • 2021-02-07 17:16

    This is a slightly hacky solution, you could remove the accounts-ui package you have and add it in manually. Find the accounts-ui branch on meteor's github repo and find all the contents in the accounts-ui package such as: login_buttons_dialogs.html, login_buttons.html, etc.

    You could then edit and copy these files into your meteor project directly with the custom text in the language you would like.

    Meteor hasn't implemented internationalization but its on the roadmap. What you could do is use meteorite and install a localization package such as simple-i18n in conjunction with the manually edited accounts-ui files to give your users a multi-lingual experience or simply offer accounts-ui in a different language.

    0 讨论(0)
提交回复
热议问题