Meteor accounts.ui localization

2020-06-02 16:58发布

I'm learning to use meteor.

Is it possible to easily localize accounts.ui components?

8条回答
时光不老,我们不散
2楼-- · 2020-06-02 17:39

The simplest way is to user accounts-tap package: https://atmospherejs.com/softwarerero/accounts-t9n

It is based on tapi18n, you have just to add the following configuration on client side :

T9n.setLanguage('<yourLanguage>')
查看更多
唯我独甜
3楼-- · 2020-06-02 17:42

For portuguese (PT-BR)

Template.layout.rendered = function() {
  $('#login-sign-in-link').text('Login ▾');
  $('.login-close-text').text('Fechar');
  $('#login-username-or-email-label').text('Nome de usuário ou e-mail');
  $('#login-password-label').text('Senha');
  $('#signup-link').text('Criar uma conta');
  $('#forgot-password-link').text('Esqueceu a senha?');
  $('#login-buttons-forgot-password').text('Recuperar');
  $('#back-to-login-link').text('Login');
  $('#login-username-label').text('Usuário para login');
  $('#login-buttons-open-change-password').text('Alterar senha');
  $('#login-buttons-logout').text('Logout');
  if ($('#login-buttons-password').text().indexOf('Sign in') != -1) {
    $('#login-buttons-password').text('Login');
  } else {
    $('#login-buttons-password').text('Criar conta');
  }
  $('.login-button').addClass('btn btn-warning');
  $('.login-button').removeClass('login-button login-button-form-submit');
  if ($('.message.error-message').text().indexOf('Username must be at least 3 characters long') != -1) {
    $('.message.error-message').text('Usuário deve ter pelo menos 3 caracteres');
  } else if ($('.message.error-message').text().indexOf('Incorrect password') != -1 || $('.message.error-message').text().indexOf('User not found') != -1) {
    $('.message.error-message').text('Usuário/senha errado(s)');
  }
  $('#login-old-password-label').text('Senha atual');
  $('#login-buttons-do-change-password').text('Alterar a senha');
  $('#reset-password-new-password-label').text('Nova senha');
  $('#login-buttons-reset-password-button').text('Alterar');
  if ($('.message.info-message').text().indexOf('Email sent') != -1) $('.message.info-message').text('E-mail enviado');
  $('#just-verified-dismiss-button').parent().html('Email verificado <div class="btn btn-warning" id="just-verified-dismiss-button">Ocultar</div>');
};


WATCH OUT BOYS!
The CLOSE in the $('.login-close-text') is the VERB... TO CLOSE
It does not mean "NEAR" as I may have read in some answers above.

查看更多
登录 后发表回答