Giter Club home page Giter Club logo

meteor-i18n's Issues

How to import the package in tests

Hi @apendua, thanks for your great work.

I'm hoping to compare a i18n value against a test value, but cannot get package to be imported as keeps saying. Error: Cannot find module 'meteor/anti:i18n'.

Tests are being ran via npm run test:dev-chimp:

"test:dev-chimp": "chimp --ddp=http://localhost:3000 --path=tests --watch --chai --mocha"

Code when testing (been shortened):

import { assert } from 'chai';
import i18n from 'meteor/anti:i18n';

...

it('Correct page title', function() {
   let title = browser.getTitle();
   expect(title).to.equal(i18n("pages.settings.user.settings"))
});

...

Any help greatly appreciated :)

AutoDetection

Just wanted to ask if this could be included into the package directly or is it better to create an own package for this?

based on navigator.language
Then the developer could just set this feature on/off with:
i18n.autoDetect = true/false (default false)

For the developer it could also mean, that the language string in the i18n.map method should be a standardized iso language string.

Language selection disappears when reloading the page.

Hi,

I tried to make a 2 languages application (en & fr).

When I change the language to French, there's no problem, the display rerenders with French values, I can navigate throughout the application... Until I reload a page: when pressing F5, the language preference is reset to default.

Great module.
Best regards.

PS: I'm using Iron Router.

Fallback language

Hi

Is it possible to use a fallback language instead of showMissing? So one could use a partial translation in one language, and english where it's missing?

Default language

I have debugged your code and I am not sure about this part :
i18n.setDefaultLanguage = function(language) {
i18n._default = 'language';
i18n._dep.changed();
};

I think it should be : i18n._default = language;

autoform reactive labels

I am using "just-i18n" with "meteor-autoform" and I want my labels to be reactive when language changes. Assigning i18n('key') to the labels defined in my "SimpleSchemas" did not help.

Isn't the global javascript function i18n() supposed to be reactive ??

I tried wrapping i18n() inside another global function trans() which returns a callback for i18n() and magically this fixed the problem. I don't know why this helped and if this is the correct way to do it ??!!

Here is my code:

// Translate reactively
transr = function(key) {
    return function() {
        return i18n(key);
    };
};

Schema.user = new SimpleSchema({
    email: {
        type: String,
        label: transr('email'),
        regEx: SimpleSchema.RegEx.Email,
    },
    //...
});

P.S. I am new to reactive programming :)

Allow raw HTML in i18n message?

For example, if I have a multi-paragraph message need to be translated, I'll have this in my i18n.js:

i18n.map('en', {
  great_text: '<p>paragraph 1</p><p>paragraph 2</p>'
});

But then {{i18n "great_text"}} will escape html tags and display following to user:

<p>paragraph 1</p><p>paragraph 2</p>

Is it possible to disable html escaping and just insert raw html into page?

How to handle markup tags

I'm coming to the i18n from .po and .mo files, so I'm not sure how to handle markup tags in this placeholder model.

I'd typically embed some simple HTML inside the translated string. For example get your <strong>toys</strong> here. But with blaze, that doesn't work, the tag gets output. What's the best way to approach this with just-i18n?

PS> Thanks for an awesome piece of software, helping to make Meteor rock onwards. ๐Ÿ‘

i18n in <title> tag

Hi,

I'm having trouble with this usage:

<head>
    <title>{{i18n 'key'}}</title>
</head>

the browser does not change this to translated message; it keeps {{i18 'key'}} as title. Is this bug or am I doing something wrong?

Cheers,
Khrone

little helper, comes in handy

just a thought for a little trick to share with the community or add as feature to your source.
maybe you'll share it on your README.md

In order to capitalize the first Character of any i18n string you can add your own little helper:
UI.registerHelper('I18n',function(string) { return i18n(string).charAt(0).toUpperCase() + i18n(string).slice(1); });

note the use of UPPERCASED I18n instead of i18n

Question - Is it safe to use the triple brackets to render HTML strings?

Hello and thank you for this package!

I was wondering if it was safe to use the triple brackets to render HTML strings like so:

# in a coffee file
i18n.map 'en_US', homepage:
  title: '<span class="bold">Meteor is</span> awesome!'

# in a template
{{{i18n 'homepage.title'}}}

As the user can easily change the content of homepage.title, it is maybe in this case a more general question, is it safe to use the triple brackets in Meteor or should we avoid such practice?

i18n.getMap() ?

What about adding a function to get the map ?
The use would be to check which languages are in the map.

Empty key is treated as not exsisting

Hi,

When I add empty key:

i18n.map('en', {
    key: ""
});

with option i18n.showMissing(true); the handlebars helper {{i18n 'key'}} is returning the key not empty string. Same goes to the i18n function. I think it's bug; and I just don't have time to write fix and make pull request on my own :)

Cheers

where and structure for i18n?

where and structure for i18n?
both or client or sever folder for this.
and the structures ????????????

both/i18n/en.i18n.json, ...kh.i18n.json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.