Comparing version 1.0.3 to 1.1.0
/** | ||
* islyngten - JavaScript library supplying I18N translation support for Node.js and the Browser. | ||
* islyngten - JavaScript library supplying I18N translation support for Node.js and the browser. | ||
* | ||
* @copyright: Copyright (c) 2013-present, Belexos GmbH | ||
* @copyright: Copyright (c) 2013-present, Belexos | ||
* | ||
@@ -12,2 +12,3 @@ * @author: Br00ze <br00ze@belexos.com> | ||
(function(window) | ||
@@ -17,4 +18,2 @@ { | ||
{ | ||
'use strict'; | ||
module.exports = Islyngten; | ||
@@ -30,2 +29,4 @@ } | ||
{ | ||
'use strict'; | ||
const _resources = {}; | ||
@@ -173,4 +174,4 @@ | ||
return new ResourceBundle(context, locale, contextResources ? contextResources[locale] : null); | ||
} | ||
}; | ||
} | ||
})(this); |
@@ -1,2 +0,2 @@ | ||
/*! islyngten V1.0.3, Copyright (c) 2013-present, Belexos GmbH. MIT licensed. */ | ||
!function(a){function b(){function a(a,b,c){function d(a,b,c){var d,g=e(a);if(1!==b&&"object"==typeof g&&(g=f(a,g,b)),g&&c)for(d in c)c.hasOwnProperty(d)&&(g=g.replace(d,e(c[d])));return g}function e(a){return c?c[a]||a:a}function f(a,b,c){var d,e,f,g,h,i;for(d in b)if(b.hasOwnProperty(d)){if(e=/(\d+)\s*-\s*(\d+)/,(f=e.exec(d))&&(g=f[1],h=f[2],c>=g&&c<=h))return b[d];if(e=/([<>]=?)\s*(\d+)/,f=e.exec(d)){var j=f[1],k=f[2];if(">"===j&&c>k)return b[d];if(">="===j&&c>=k)return b[d];if("<"===j&&c<k)return b[d];if("<="===j&&c<=k)return b[d]}if(e=/\s*,\s*/,f=d.split(e))for(i=0;i<f.length;i++)if(c===~~f[i])return b[d]}return a}this.context=function(){return a},this.locale=function(){return b},this._=this.t=this.get=function(a,b){return d(a,1,b)},this.__=this.tt=this.nget=function(a,b,c,e){return 1===c?d(a,1,e):d(b,c,e)}}const b={};this.resources=function(a,c,d){b[a]||(b[a]={}),b[a][c]=d},this.resourceBundle=function(c,d){var e=b[c];return new a(c,d,e?e[d]:null)}}"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=b:a.Islyngten=b}(this); | ||
/*! islyngten V1.1.0, Copyright (c) 2013-present, Belexos. MIT licensed. */ | ||
!function(t){function n(){"use strict";const t={};function n(t,n,e){function r(t,n,e){var r,u=i(t);if(1!==n&&"object"==typeof u&&(u=function(t,n,e){var r,i,u,o,f,s;for(r in n)if(n.hasOwnProperty(r)){if((u=(i=/(\d+)\s*-\s*(\d+)/).exec(r))&&(o=u[1],f=u[2],e>=o&&e<=f))return n[r];if(u=(i=/([<>]=?)\s*(\d+)/).exec(r)){var c=u[1],h=u[2];if(">"===c&&e>h)return n[r];if(">="===c&&e>=h)return n[r];if("<"===c&&e<h)return n[r];if("<="===c&&e<=h)return n[r]}if(i=/\s*,\s*/,u=r.split(i))for(s=0;s<u.length;s++)if(e===~~u[s])return n[r]}return t}(t,u,n)),u&&e)for(r in e)e.hasOwnProperty(r)&&(u=u.replace(r,i(e[r])));return u}function i(t){return e&&e[t]||t}this.context=function(){return t},this.locale=function(){return n},this._=this.t=this.get=function(t,n){return r(t,1,n)},this.__=this.tt=this.nget=function(t,n,e,i){return 1===e?r(t,1,i):r(n,e,i)}}this.resources=function(n,e,r){t[n]||(t[n]={}),t[n][e]=r},this.resourceBundle=function(e,r){var i=t[e];return new n(e,r,i?i[r]:null)}}"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=n:t.Islyngten=n}(this); |
{ | ||
"name": "islyngten", | ||
"version": "1.0.3", | ||
"description": "Islyngten is a tiny JavaScript library supplying I18N translation support for Node.js and the Browser.", | ||
"version": "1.1.0", | ||
"description": "Islyngten is a tiny JavaScript library supplying I18N translation support for Node.js and the browser.", | ||
"main": "islyngten.js", | ||
@@ -10,4 +10,8 @@ "directories": { | ||
"scripts": { | ||
"test": "nyc ./node_modules/.bin/jasmine", | ||
"build": "grunt build" | ||
"build": "grunt build", | ||
"coverage": "nyc ./node_modules/.bin/jasmine", | ||
"lint": "grunt jshint", | ||
"test": "./node_modules/.bin/jasmine && npx karma start test/karma/karma.conf.js --single-run", | ||
"test-node": "./node_modules/.bin/jasmine", | ||
"test-browser": "npx karma start test/karma/karma.conf.js --single-run" | ||
}, | ||
@@ -43,8 +47,14 @@ "repository": { | ||
"devDependencies": { | ||
"grunt": "^1.0.4", | ||
"grunt-contrib-uglify": "^2.3.0", | ||
"grunt": "^1.3.0", | ||
"grunt-contrib-jshint": "^2.1.0", | ||
"grunt-contrib-watch": "^1.1.0", | ||
"jasmine": "^3.5.0", | ||
"nyc": "^15.0.0" | ||
"grunt-terser": "^1.0.0", | ||
"jasmine": "^3.6.1", | ||
"karma": "^5.1.1", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-coverage": "^2.0.3", | ||
"karma-firefox-launcher": "^1.3.0", | ||
"karma-jasmine": "^4.0.1", | ||
"nyc": "^15.1.0" | ||
} | ||
} |
Islyngten | ||
========= | ||
`Islyngten` is a tiny JavaScript library supplying I18N translation support for Node.js and the Browser. | ||
`Islyngten` is a tiny JavaScript library supplying I18N translation support for Node.js and the browser. | ||
It provides simple, yet powerful solutions for multiple plural forms and interpolation. | ||
@@ -36,7 +36,7 @@ `Islyngten` has no dependencies. | ||
### Browser | ||
`Islyngten` has no dependencies, which makes it easy to include in a Browser. | ||
`Islyngten` has no dependencies, which makes it easy to include in a browser. | ||
You can download the latest release from the repository | ||
* [`islyngten.js`](https://github.com/belexos/islyngten/blob/master/islyngten.js) unminified including comments, 3.4 kB | ||
* [`islyngten.min.js`](https://github.com/belexos/islyngten/blob/master/islyngten.min.js) minified version, 1.15 kB | ||
* [`islyngten.js`](https://github.com/belexos/islyngten/blob/master/islyngten.js) unminified, including comments | ||
* [`islyngten.min.js`](https://github.com/belexos/islyngten/blob/master/islyngten.min.js) minified version | ||
@@ -193,5 +193,5 @@ Use a script tag to directly add `Islyngten` to the global scope. | ||
The previous examle showed an easy way to support simple plural forms by using the nget() [ __(), tt() ] methods. | ||
The previous examle showed an easy way to support simple plural forms by using the `nget()` [` __()`, `tt()` ] methods. | ||
But what, if you need to translate in other languages where multiple plural forms exist? | ||
For example, in Polish, the word ‘file’ pluralises like this: | ||
For example, in Polish, the word "file" pluralises like this: | ||
* 1 plik | ||
@@ -278,8 +278,15 @@ * 2,3,4 pliki | ||
------- | ||
We are using [Jasmine testing framework](https://jasmine.github.io/index.html) and [Istanbul test coverage framework](https://istanbul.js.org/). | ||
We use | ||
* [JSHint](https://jshint.com/) for static code analysis. | ||
* [Jasmine testing framework](https://jasmine.github.io/index.html) for testing. | ||
* [Karma test runner](https://karma-runner.github.io/latest/index.html) for testing in the browser. | ||
* [Istanbul test coverage framework](https://istanbul.js.org/) for tracking test coverage. | ||
Steps to be taken | ||
* Clone or download the repository. | ||
* Change into project directory. | ||
* Change into the project directory. | ||
* Use `npm install` to install all development dependencies. | ||
* Use `npm runt lint` to run static code analysis. | ||
* Use `npm test` to run the tests. | ||
* Use `npm run coverage` to track test coverage. | ||
* The output should display successful execution results and a code coverage map. | ||
@@ -292,3 +299,3 @@ | ||
* Change into project directory. | ||
* Use `grunt` in project directory to build `islyngten.min.js` from `islyngten.js`. | ||
* Use `npm run build` in project directory to build `islyngten.min.js` from `islyngten.js`. | ||
@@ -305,7 +312,10 @@ | ||
------ | ||
We use GitHub issues to track bugs. Please ensure your bug description is clear and has sufficient instructions to be able to reproduce the issue. | ||
We use GitHub issues to track bugs. Please ensure your bug description is clear and has sufficient instructions to be | ||
able to reproduce the issue. | ||
The absolute best way to report a bug is to submit a pull request including a new failing test which describes the bug. When the bug is fixed, your pull request can then be merged. | ||
The absolute best way to report a bug is to submit a pull request including a new failing test which describes the bug. | ||
When the bug is fixed, your pull request can then be merged. | ||
The next best way to report a bug is to provide a reduced test case on jsFiddle or jsBin or produce exact code inline in the issue which will reproduce the bug. | ||
The next best way to report a bug is to provide a reduced test case on jsFiddle or jsBin or produce exact code inline | ||
in the issue which will reproduce the bug. | ||
@@ -321,2 +331,11 @@ | ||
--------- | ||
v1.1.0 | ||
* Update npm modules. | ||
* Update and extend test environment. | ||
* Add static code analysis tool JSHint. | ||
* Add Karma test runner. | ||
* Fix JSHint issues. | ||
* Replace uglify-js by terser for minification. | ||
* Update README. | ||
v1.0.3 | ||
@@ -337,2 +356,2 @@ * Update npm modules. | ||
------- | ||
Copyright (c) 2013-present, Belexos GmbH. `Islyngten` is licensed under the [MIT License](https://github.com/belexos/islyngten/blob/master/LICENSE). | ||
Copyright (c) 2013-present, Belexos. `Islyngten` is licensed under the [MIT License](https://github.com/belexos/islyngten/blob/master/LICENSE). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16546
351
11