Skip to content

Cannot get data-i18n to work #212

@FabienCharlet

Description

@FabienCharlet

Hello !

Thanks for your work and your great library :)

I'm not an experienced Javascript developer and I'm having trouble having basic features to work ...
I'm probably missing something ;)

First, I've cloned the repository, edited the index.html file and add at the first line after <div class="container"> :

Test : <p data-i18n="one"></p>

This result to : Test : .

But, after reading the doc, I would think that, as the page contains <html lang="en" dir="ltr"> , I would see Test : ONE because demo-en.json contains "one": "ONE".

The rest of the page works when I change the value in the dropdown. So I think I have misunderstood something.

I tested another thing and I have an unexpected behavior too.

I edited the demo.js file and at the end of the last function I added :

$.i18n().load( 'i18n/demo-he.json', 'he')
	
$.i18n({
	    locale: 'he' // Locale is Hebrew
});
	
alert($.i18n( 'one' ));

Once again, regarding to the doc, I would expect to view the translation of 'one' which is in the demo-he.json file. But I only see one. Whatever the message I search I always have the key displayed and not the value.

Am I missing something ?

Thanks in advance for your time 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions