How do you use the meteor-accounts-t9n package?

1.3k views Asked by At

I'm once again attempting to use the meteor-accounts-t9n package and I'm seriously flipping out with the vague explanations provided in the package's GitHub.

I added the package with meteor add meteor-accounts-t9n as well as the accounts-password and accounts-ui packages.

Then I created part of my usual project structure: client folder, server folder and lib folder. I got nothing on server for now.

I configured my client html to be like:

<head>
  <title>t9nTest</title>
</head>
<body>
    {{> hello}}
</body>

<template name="hello">
    {{> loginButtons}}
</template>

My javascript is like:

Template.loginButtons.onRendered(function(){
    T9n.setLanguage("pt");
});

I've attempted with Meteor.startup as well.

I added a t9n folder under lib. On that folder I put a file called pt.coffee and put the entire portuguese structure available on the project's github.

KEEP IN MIND THIS IS MY ONLY COFFESCRIPT FILE - I'M WANT TO USE JAVASCRIPT

Still nothing. What am I missing? What is the appropriate usage of the package in order to translate the accounts-ui loginButtons form?

I also have gotten this error on the client-side: "Uncaught Error: No such function: t9n" when I attempt to directly convert a string returned by a helper function with `

{{t9n textReturned}}

1

There are 1 answers

0
SylvainB On BEST ANSWER

As far as I know, in terms of translations for account-related UI elements (buttons, links, placeholders and so on), meteor-accounts-t9n is set to work with the meteor-useraccounts packages. (core and framework-specific, such as bootstrap, foundation, ratchet...)

With the meteor-useraccounts packages installed and in use (using {{> atForm}}), all you need to do is, like you said, install the meteor-accounts-t9n package:

$ meteor add softwarerero:accounts-t9n

And that's it, the translations should be in place according to the default language. All you need to do to change the language for your account elements is (here for portuguese):

T9n.setLanguage("pt");