How do you use meteor-accounts-t9n?

I’m once again attempting to use this 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}}

A few key points:

  1. Always look on atmospherejs.com what the package name is, when in doubt. Here it is softwarerero:accounts-t9n --> meteor add softwarerero:accounts-t9n
  2. T9n.setLanguage("pt"); should be done in the top level, shared lib/ folder, in top-level code (i.e. not in Meteor.startup).
  3. No need to put any of their files from Github directly into your project. Adding their package is enough for the standard translations. The example that they give with the lib/t9n folder and the coffeescript file in there is for if you’d like to add some of your own, non-standard texts. You can also use Javascript for that. Here’s what it should look like, if you ever need that:
T9n.map('de', {
    error: {
        signInRequired: 'Bitte anmelden',
        accounts: {
            "Must be logged in": 'Bitte anmelden'
        }
    },
    ifYouAlreadyHaveAnAccount: 'Du bist bereits Kunde?',
    signin: 'Anmelden'
});

This works, I’m using it like that on multiple projects. So in case you still get errors or nothing, then make sure you got all (simple) steps correct and you’ll be fine! HTH!

Tried everything as you said. I still am unsuccessful.
For the record:

  1. I already had added that package. I verified it with meteor list.
  2. I put T9n.setLanguage(“pt”) in my root /lib folder.
  3. I removed the coffeescript file. Didn’t work all the same. I tried mapping the words. Nothing. No errors given.

Start over, try getting it to work in a completely fresh app, just to exclude everything that might go wrong – which I don’t know specifically what that could be, but it’s a good idea anyway to eliminate variables from the equation of “Y U NO WORK?!”. :smile:

All I can think of for now.

Except… what do you mean by “I tried mapping the words”? We’re talking about setting the language used for accounts-password, right? Actually I’m even using the useraccounts:core package on top, not plain accounts-password.

# accounts
accounts-password
softwarerero:accounts-t9n
useraccounts:core
# plus those, but those should not matter
semantic:ui-css
useraccounts:semantic-ui

That’s probably the issue. Another user on stackoverflow also said he is using that package (useraccounts:core) instead of accounts-ui (I see you are not using it as well, only accounts-password).