GithubHelp home page GithubHelp logo

cfv1984 / pomo Goto Github PK

View Code? Open in Web Editor NEW
68.0 68.0 5.0 161 KB

Pomo is a JS implementation of GNU gettext in a compact module; it reads PO files, eventually MO files, and can load them from AJAX, special <link> tags and literal strings

License: MIT License

JavaScript 83.14% CSS 4.09% HTML 12.76%

pomo's People

Contributors

cfv1984 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pomo's Issues

License

Hi there,

didn't know where to ask.
Under which license did you publish this fantastic piece of work? It's great and we might want to use this in one of our projects.

Thanks in advance!
Greetings

get message wrong for context

I tried to get a context message and found it.

--- a/src/dist/pomo.js
+++ b/src/dist/pomo.js
@@ -854,8 +854,8 @@ var Pomo = function () {
             var entry = me.storage.contents[domain][escaped];
             if (!!context) {
                 for (var i = 0, j = entry.length; i < j; i++) {
-                    if (entry.context && entry.context === context) {
-                        translation = entry[i];
+                    if (entry[i].context && entry[i].context === context) {
+                        entry = entry[i];
                         break;
                     }
                 }

Bug: Variables do not work with returnStrings = true

Variables do not work when returnStrings = true is set.

See the following minimal example:

let po = 'msgid "foo %d"\nmsgstr "bar %d"\n';
Pomo.load(po, { format: 'po', mode: 'literal'});
Pomo.returnStrings = true;
console.log(Pomo.getText("foo %d", { variables: [10] }))   // returns "bar %d"

With returnStrings = false, the command returns bar 10 as expected :

let po = 'msgid "foo %d"\nmsgstr "bar %d"\n';
Pomo.load(po, { format: 'po', mode: 'literal'});
console.log(Pomo.getText("foo %d", { variables: [10] }).translation)   // returns "bar 10"

Fix travis's running of the tests.

It currently says it cannot load them from the relative path it is attempting to. It should be able to without much issue, but I currently do not really have the time to deal with it as the tests do run just fine locally.

If the file does not has enters between messages it fails

Translations of aaaa aa module

msgid ""
msgstr ""
"Project-Id-Version: aa:aa (7.x-3.12)\n"
"POT-Creation-Date: 2015-06-30 01:28+0000\n"
"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
"Language-Team: aaaa aaa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n!=1);\n"

msgid "Updated"
msgstr "Updated"
msgid "Measurements"
msgstr "Measurements"

This fails, only has Measurements on it. Updated is ignored.

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.