Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Andreas Lappe
    @alappe
    hey @tinganho, I am looking to use l10ns with CoffeeScript but I do have my problems with the workflow… does the source key in l10ns.json have to contain all files, no way of using a path like .? And then the localization-files contain references to the source-files, why that? I am using CoffeeScript with browserify, so while I have a bunch of source files, I only have one output file… Maybe I am totally wrong here…
    Tingan Ho
    @tinganho
    hi @alappe the source in l10ns.json is just using glob file patterns. And the source doesn't need to be JS but they need to have the syntax l('SOME_KEY'[, {...}]). They contain references to files to resolve renaming of keys. And the files property could be used in more purposes in the future.
    Ricardo Machado
    @mAiNiNfEcTiOn

    Hi @tinganho, I’ve been checking a few ways to create the handlebars plugin for l10ns. So I have a few questions:

    1. As I could see from your code and the structure of the l10ns.json, we cannot have multiple plugins/languages being parsed in a project… Is that so?

    2. Another thing that I noticed was that, if you define different projects, saving the localizations and the output in the same directories, it clears the previous state: So, projectA saves, then projectB saves and clears the detected labels of projectA.
      Although I find this a normal behavior, if a project does not support multiple ‘plugins’ and, at the same time, the system does not support multiple projects saving in the same directory (parsing different files), that means you can only parse a specific language.

    So finally, my suggestion would be to change the system (and it’s configuration file) to support multiple plugins (having a configuration per plugin) per project.

    So, to be more accurate, I would change your l10ns.json structure to something like this:
    {
      "projects": {
        “myProject": {
          "programmingLanguage": {
            “javascript”: {
               "source": [“example/myProject/*.js"]
            },
            “handlebars”: {
               "source": [“example/myProject/*.hbs"]
            }
          },
          "languages": {
            "en-US": "English (US)"
          },
          "quiet" : false,
          "defaultLanguage": "en-US",
          "currencies": [
            "USD"
          ],
          "store": "example/javascript/localizations",
          "output": "example/javascript/output",
         ,
          "interface" : {
            "autoOpen": false,
            "port": 3004
          }
        }
      },
      "defaultProject": “myProject"
    }
    Ricardo Machado
    @mAiNiNfEcTiOn
    This way, the project can have multiple programmingLanguages, with different sources, outputting to the same location :)
    Tingan Ho
    @tinganho
    Right now, L10ns is not pluggable. Though I want to add it in the future. I recently got the knowledge of how to architect L10ns correctly after having contributed to compilers.
    That future is not in the near term though, because it will need a total rewrite of the project. Since I got too much on my pipeline recently.
    Ricardo Machado
    @mAiNiNfEcTiOn
    Hmmm… Ok… I understand.
    Tingan Ho
    @tinganho
    L10ns is really a big project also. Though don’t know why people want to put the localization info in the templates? Insted of passing it as variables?
    Ricardo Machado
    @mAiNiNfEcTiOn
    I don’t want you to think I’m pushing you to do it ;-) These are just some suggestions :) … If I do an attempt, would you - whenever you have time - take a look at it and tell me what do you think?
    Tingan Ho
    @tinganho
    Hmm I would recommend to not attempt right now. It really doesn’t fit the project right now. It isn’t designed to be pluggable.
    though I appreciate your interest
    If I knew how to write L10ns from the beginning, which in other words know how to write and architect a compiler plus an internationalization framework. I would probably done it right at the beginning. Though, I didn’t have that experience at that time.
    Ricardo Machado
    @mAiNiNfEcTiOn
    Ok then :)
    DzmitryKukharuk
    @DzmitryKukharuk
    Hello guys. I have one interesting question, how can we create labels for a couple of project in one time ? For example, we have 2 projects: 'project1 and 'project2' in l10ns.json file. Can we create labels for each of them and store in separate directories ('project1' and 'project2' accordingly) ? Thanks a lot :)
    DzmitryKukharuk
    @DzmitryKukharuk
    As i see, using -p parameter we can specify only one project.
    Tingan Ho
    @tinganho
    @DzmitryKukharuk it is not doable today. Though I have thought about it. I might implement it in version 3.0.
    Ricardo Machado
    @mAiNiNfEcTiOn
    Question: Did anyone had this awesome issue of installing l10ns and suddenly the l10ns compile stopped working because 'cldr-data/defaultContent.json’ is not found?
    Ricardo Machado
    @mAiNiNfEcTiOn
    Ah nevermind
    We realized that we were installing npm@latest in our machines, which means that we were installing npm 3.3, now fixed to 2.14.1
    Sorry to bother ;)
    Tingan Ho
    @tinganho
    @mAiNiNfEcTiOn do you say that l10ns doesn't work with the latest npm?
    In such case, I will check it out
    Ricardo Machado
    @mAiNiNfEcTiOn
    Well at that time, no =x now, I don’t know, haven’t tested since
    C-A de Salaberry
    @cadesalaberry

    Hi there, I have two small questions on l10ns:

    Q1

    Is there a reason why we would have to use the -> namespace token ?
    As in, is l10ns treating it differently if it is MENU->TITLE over MENU__TITLE ?

    Q2

    Secondly, Is there a way to change the current language dynamically in the app ?

    At the beginning of my app, I am calling:

    var l = requireLocalizations('fr-FR');

    Then on the other pages on my app, I am importing l and calling:

    var title = l('MENU__TITLE');

    Now, If I want to change the language of the entire app, can I do it from the l variable ?

    Something along:

    l.changeLocalization('en-US');
    // or 
    l().changeLocalization('en-US');

    Instead of redefining the l variable ?

    Tingan Ho
    @tinganho
    @cadesalaberry no there is no reason. You can pretty much have whatever you want as a separator.
    No you cannot do it from the l variable. You can only do that from requreLocalizations
    C-A de Salaberry
    @cadesalaberry
    @tinganho Thanks a lot !
    C-A de Salaberry
    @cadesalaberry

    I guess I can't help but add a third question :smile:
    Is there a way to mix DATE FORMAT and SELECTORDINAL to display

    {?} --> Apr, 23rd

    Instead of

    {date, date, MMM d} --> Apr, 23
    Tingan Ho
    @tinganho
    @cadesalaberry No there isn't. Though I have thought about your problem with showing ordinals on dates. And the standard in date formats and in English and many other languages's is to not show the ordinal suffixes. Just google it or look at many documents in many languages. And you can see the standard is to not show the ordinal suffix.
    Because I couldn't find any languages display ordinals I didn't add support for it in L10ns.
    *display ordinals on date formats.
    Marius Rickenbacher
    @gwildu
    @tinganho when following the getting started instructions, I get the following error:
    [error] E_MISSING_BUNDLE: {"locale":"de-CH"}
    Any Idea?

    at step
    l10ns set @1 "Vorname"

    My test.js file:

    "use strict";
    
    var requireLocalizations = require('localizations');
    var l = requireLocalizations('de-CH');
    var firstname = l('LOCALIZATION_MODULE-FIRSTNAME');
    var lastname = l('LOCALIZATION_MODULE-LASTNAME');

    my l10ns.json file:

    {
      "defaultProject": "test",
      "projects": {
        "test": {
          "timezones": [
            "America/Los_Angeles"
          ],
          "currencies": [
            "USD"
          ],
          "interface": {
            "autoOpen": true,
            "port": 3001
          },
          "languages": {
            "de-CH": "German",
            "fr-CH": "French"
          },
          "defaultLanguage": "de-CH",
          "programmingLanguage": "javascript",
          "store": "localizations//",
          "output": "localizations//output",
          "source": [
            "test.js"
          ]
        }
      }
    }
    Tingan Ho
    @tinganho
    @gwildu little bit late but the error have now been fixed.
    Joan Saum
    @joan-saum

    Hi @tinganho
    Maybe you are not here anymore ?

    I forked your l10ns and i want add little feature on it but i don't know how compile the project with my modifications ?