Status

L20n
JS Library
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Yan-Fa Li, Assigned: Craig Michael Thompson)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36

Steps to reproduce:

✗ bower search l20n


Actual results:

Search results:

    angularjs-l20n git://texthtml.net/webapp/lib/angularjs/l20n



Expected results:

Search results:
    l20n git@github.com:l20n/l20n.js.git
    angularjs-l20n git://texthtml.net/webapp/lib/angularjs/l20n

I would like to use l20n in my javascript projects. l20n is in npm, but it's not available in bower, which is the tool of choice for yeoman based projects. It would be great if you could make it officially supported and available to the yeoman and bower communities.

Comment 1

4 years ago
I'm interesting this too. I made a webapp template based on l20n as well https://github.com/gasolin/webapplate ,currently I have to bundle l20n into the template.


Maybe we could add dist/ folder similar to
http://mozilla.github.io/localForage/

So bower could take care the rest part. I could help the bower part
(Assignee)

Comment 2

4 years ago
This could also be easily achieved by adding a `bower.json` file to the existing `l20n/builds` repository on GitHub here: https://github.com/l20n/builds

```
{
    "name": "l20n",
    "main": "l20n.min.js",
    "description": "A natural-language localization framework",
    "version": "1.0.0rc",
    "homepage": "http://l20n.org",
    "authors": [
      "Mozilla <l10n-drivers@mozilla.org>",
      "Zbigniew Braniecki",
      "Staś Małolepszy"
    ],
    "license": "Apache 2.0",
    "keywords": [
      "localization",
      "l10n",
      "l20n"
    ]
}
```

And registering it using `bower register https://github.com/l20n/builds l20n`

Comment 3

4 years ago
good idea, could you create a Pull Request on github for that?
Flags: needinfo?(craga89)
(Assignee)

Comment 4

4 years ago
Added the file and requested a pull: https://github.com/l20n/builds/pull/1
Flags: needinfo?(craga89)

Comment 5

4 years ago
Created attachment 8404596 [details] [review]
pull request redirect to github
Attachment #8404596 - Flags: review?(gandalf)

Updated

4 years ago
Assignee: nobody → craga89
Thanks for the pull request, Craig!  I haven't worked with bower before, but I'll read the docs and review the pull request today or tomorrow.

One question:  is it helpful to have the dist version of L20n in bower, or should we register the AMD-enabled version suitable for use with for instance RequireJS? Or both?
(Assignee)

Comment 7

4 years ago
Happy to help! In fact, both would be useful depending on people's environments. Libraries such as `Handlebars` handle this by exposing both "Globalized" and AMD specific builds, see: https://github.com/components/handlebars.js/blob/master/handlebars.js

There's also the option of utilising the "Universal Module Definition" pattern and providing a single file that works in all environments (Browser, Node and AMD), great article on this here: http://bob.yexley.net/umd-javascript-that-runs-anywhere/. 

I'm not averse to either, I use RequireJS in my own production builds, so an AMD specific build would be ideal, but the overhead of adding the UMD definition is in the order of a few hundred bytes, so I'd air towards that psersonally!
(Reporter)

Comment 8

4 years ago
Thanks for working on this guys. I'm using RequireJS too. I use a patched version of @fernandogmar L20n-RequireJS to load the translations automatically. I submitted a bug report, but he doesn't appear to be maintaining it any longer so the github uses an older API.

Comment 9

4 years ago
@stas, it's possible to use github release with version name ex: `v1.0`, so bower will take the current release version. We already did it in BuildingBlocks (firefoxos UI) https://github.com/buildingfirefoxos/Building-Blocks/releases

$ bower install building-blocks

or specify a target version with #

$ bower install building-blocks#1.2.1
Comment on attachment 8404596 [details] [review]
pull request redirect to github

not sure if I'm the best reviewer since I don't understand bower :) But the code looks clean and green, so r+
Attachment #8404596 - Flags: review?(gandalf) → review+
Status: UNCONFIRMED → NEW
Ever confirmed: true
Landed in https://github.com/l20n/builds/commit/5b1340b8991b1b6efe9769685561e2962d7351b4.  Thanks for everyone's help!

You can now use `bower info l20n` to see the details of the l20n package.

I plan to also register a l20n-amd package from the l20n/l20n.js repository.
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.