Permalink
Browse files

copied playground over - new 2.0.0 alpha

  • Loading branch information...
1 parent ade4afc commit e1b4f594ac8b983df4f1035b4bfe639b13d99f4c @jamuhl jamuhl committed Nov 12, 2015
Showing with 8,046 additions and 0 deletions.
  1. +3 −0 .babelrc
  2. +9 −0 .editorconfig
  3. +3 −0 .eslintignore
  4. +108 −0 .eslintrc
  5. +18 −0 .gitignore
  6. +11 −0 .npmignore
  7. +21 −0 LICENSE
  8. +2 −0 bin/index.js
  9. +1 −0 bin/index.js.map
  10. +21 −0 bower.json
  11. +168 −0 gulpfile.js
  12. +44 −0 karma.backward.conf.js
  13. +54 −0 karma.conf.js
  14. +231 −0 lib/BackendConnector.js
  15. +70 −0 lib/EventEmitter.js
  16. +146 −0 lib/Interpolator.js
  17. +98 −0 lib/LanguageUtils.js
  18. +182 −0 lib/PluralResolver.js
  19. +158 −0 lib/ResourceStore.js
  20. +297 −0 lib/Translator.js
  21. +118 −0 lib/compatibility/1.10.x.js
  22. +133 −0 lib/compatibility/v1.js
  23. +66 −0 lib/defaults.js
  24. +359 −0 lib/i18next.js
  25. +14 −0 lib/index.js
  26. +110 −0 lib/logger.js
  27. +25 −0 lib/postProcessor.js
  28. +136 −0 lib/utils.js
  29. +70 −0 package.json
  30. +9 −0 readme.md
  31. +176 −0 src/BackendConnector.js
  32. +45 −0 src/EventEmitter.js
  33. +111 −0 src/Interpolator.js
  34. +63 −0 src/LanguageUtils.js
  35. +242 −0 src/PluralResolver.js
  36. +112 −0 src/ResourceStore.js
  37. +229 −0 src/Translator.js
  38. +124 −0 src/compatibility/v1.js
  39. +59 −0 src/defaults.js
  40. +254 −0 src/i18next.js
  41. +3 −0 src/index.js
  42. +79 −0 src/logger.js
  43. +17 −0 src/postProcessor.js
  44. +120 −0 src/utils.js
  45. +26 −0 test/backend/backendConnector.load.retry.spec.js
  46. +26 −0 test/backend/backendConnector.load.spec.js
  47. +27 −0 test/backend/backendMock.js
  48. +41 −0 test/backend/xhr.spec.js
  49. +11 −0 test/backward/locales/de/translation.json
  50. +7 −0 test/backward/locales/dev/ns.common.json
  51. +6 −0 test/backward/locales/dev/ns.special.json
  52. +7 −0 test/backward/locales/dev/translation.json
  53. +6 −0 test/backward/locales/en-US/ns.common.json
  54. +6 −0 test/backward/locales/en-US/ns.special.json
  55. +7 −0 test/backward/locales/en-US/translation.json
  56. +7 −0 test/backward/locales/en/ns.common.json
  57. +6 −0 test/backward/locales/en/ns.special.json
  58. +11 −0 test/backward/locales/en/translation.json
  59. +6 −0 test/backward/locales/fr/translation.json
  60. +2,658 −0 test/backward/v1.11.1.compat.js
  61. +59 −0 test/i18next.spec.js
  62. +79 −0 test/interpolation.spec.js
  63. +150 −0 test/languageUtils.spec.js
  64. +1 −0 test/locales/en/nonjson.json
  65. +3 −0 test/locales/en/test.json
  66. +76 −0 test/pluralResolver.spec.js
  67. +107 −0 test/resourceStore.spec.js
  68. +48 −0 test/translator/translator.getResource.spec.js
  69. +67 −0 test/translator/translator.translate.context.spec.js
  70. +65 −0 test/translator/translator.translate.plural.spec.js
  71. +55 −0 test/translator/translator.translate.returnObject.spec.js
  72. +63 −0 test/translator/translator.translate.separator.spec.js
  73. +57 −0 test/translator/translator.translate.spec.js
  74. +39 −0 todo.md
View
@@ -0,0 +1,3 @@
+{
+ "stage": 0
+}
View
@@ -0,0 +1,9 @@
+# EditorConfig is awesome: http://EditorConfig.org
+root = true
+
+[*.{js,jsx,json}]
+end_of_line = lf
+insert_final_newline = true
+charset = utf-8
+indent_style = space
+indent_size = 2
View
@@ -0,0 +1,3 @@
+**/dist/*
+**/node_modules/*
+**/*.min.*
View
@@ -0,0 +1,108 @@
+---
+parser: babel-eslint
+
+ecmaFeatures:
+ arrowFunctions: true
+ blockBindings: true
+ classes: true
+ defaultParams: true
+ destructuring: true
+ forOf: true
+ generators: false
+ modules: true
+ objectLiteralComputedProperties: true
+ objectLiteralDuplicateProperties: false
+ objectLiteralShorthandMethods: true
+ objectLiteralShorthandProperties: true
+ spread: true
+ superInFunctions: true
+ templateStrings: true
+
+env:
+ browser: true
+ node: true
+ es6: true
+
+globals:
+ __resourceQuery: false
+ bootstrap: false
+ describe: false
+ describeSaga: false
+ describeEvent: false
+ describeCommand: false
+ describeScene: false
+ before: false
+ it: false
+ xit: false
+ window : false
+ beforeEach : false
+ afterEach : false
+ after : false
+ before : false
+ beforeEachChapter: false
+ describeScenario: false
+ describeChapter: false
+ describeStep: false
+ document : false
+ window: false
+ File : false
+ FormData: false
+ QCodeDecoder: false
+ $: false
+ L: false
+ btoa: false
+ escape: false
+ angular: false
+ jQuery: false
+ ga: false
+
+settings:
+ jsx: true
+
+ecmaFeatures:
+ jsx: true
+
+rules:
+
+ # ERRORS
+ curly: [2, "multi-line"]
+
+ # WARNINGS
+ no-unused-vars: [1, {vars: all, args: none}]
+ semi-spacing: 1
+ no-empty: 1
+ handle-callback-err: 1
+ eqeqeq: 1
+ quotes: [1, 'single']
+ no-unused-expressions: 1
+ no-throw-literal: 1
+ semi: 1
+ block-scoped-var: 1
+ no-alert: 1
+ no-console: 1
+ new-cap: 1
+ space-unary-ops: 1
+
+ # DISABLED
+ space-after-keywords: 0
+ dot-notation: 0
+ consistent-return: 0
+ brace-style: 0
+ no-multi-spaces: 0
+ no-underscore-dangle: 0
+ key-spacing: 0
+ comma-spacing: 0
+ no-shadow: 0
+ no-mixed-requires: 0
+ space-infix-ops: 0
+ strict: 0
+ camelcase: 0
+ no-wrap-func: 0
+ comma-dangle: 0
+ no-extra-semi: 0
+ no-use-before-define: [0, "nofunc"]
+
+ # AUTOMATED BY EDITORCONFIG
+ eol-last: 0
+ no-trailing-spaces: 0
+ indent: 0
View
@@ -0,0 +1,18 @@
+# Ignore specific files
+.settings.xml
+.monitor
+.DS_Store
+*.orig
+npm-debug.log
+npm-debug.log.*
+*.dat
+
+# Ignore various temporary files
+*~
+*.swp
+
+
+# Ignore various Node.js related directories and files
+node_modules
+node_modules/**/*
+coverage/**/*
View
@@ -0,0 +1,11 @@
+test/
+src/
+coverage/
+.babelrc
+.editorconfig
+.eslintignore
+.eslintrc
+.gitignore
+bower.json
+gulpfile.js
+karma.conf.js
View
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 i18next
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
View
Oops, something went wrong.
View
Oops, something went wrong.
View
@@ -0,0 +1,21 @@
+{
+ "name": "i18next",
+ "version": "2.0.0-alpha.23",
+ "main": "./bin/index.js",
+ "dependencies": {},
+ "ignore": [
+ "test/",
+ "lib/",
+ "src/",
+ "coverage/",
+ ".babelrc",
+ ".gitignore",
+ ".editorconfig",
+ ".eslintignore",
+ ".eslintrc",
+ ".npmignore",
+ "gulpfile.js",
+ "package.json",
+ "karma.conf.js"
+ ]
+}
View
@@ -0,0 +1,168 @@
+var gulp = require('gulp'),
+ babel = require('gulp-babel'),
+ prompt = require('gulp-prompt'),
+ git = require('gulp-git'),
+ bump = require('gulp-bump'),
+ filter = require('gulp-filter'),
+ tag_version = require('gulp-tag-version'),
+ shell = require('gulp-shell'),
+ argv = require('yargs').argv,
+ gulpif = require('gulp-if'),
+ uglify = require('gulp-uglify'),
+ sourcemaps = require('gulp-sourcemaps'),
+ source = require('vinyl-source-stream'),
+ buffer = require('vinyl-buffer'),
+ browserify = require('browserify'),
+ watchify = require('watchify'),
+ babelify = require('babelify'),
+ eslint = require('gulp-eslint'),
+ Server = require('karma').Server;
+
+var pkg = require('./package.json');
+
+var entry = 'i18next.js',
+ standaloneName = 'i18next',
+ output = 'index.js';
+
+function compile(watch) {
+ var bundler = browserify('./src/' + entry, { debug: argv.debug, standalone: standaloneName }).transform(babelify);
+ if (watch) {
+ bundle = watchify(bundler);
+ }
+
+ function rebundle() {
+ bundler.bundle()
+ .on('error', function(err) { console.error(err); this.emit('end'); })
+ .pipe(source(output))
+ .pipe(buffer())
+ .pipe(gulpif(!argv.debug, uglify()))
+ .pipe(gulpif(argv.debug, sourcemaps.init({ loadMaps: true })))
+ .pipe(gulpif(argv.debug, sourcemaps.write('./')))
+ .pipe(gulp.dest('./bin'));
+ }
+
+ if (watch) {
+ bundler.on('update', function() {
+ console.log('-> bundling...');
+ rebundle();
+ });
+ }
+
+ rebundle();
+}
+
+gulp.task('eslint', function () {
+ return gulp.src(['src/**/*.js'])
+ .pipe(eslint({
+ useEslintrc: true
+ }))
+ .pipe(eslint.format())
+ .pipe(eslint.failAfterError());
+});
+
+gulp.task('test', function (done) {
+ new Server({
+ configFile: __dirname + '/karma.conf.js',
+ singleRun: true,
+ reporters: [ 'spec', 'coverage' ],
+ }, done).start();
+});
+
+gulp.task('test_compat', function (done) {
+ new Server({
+ configFile: __dirname + '/karma.backward.conf.js'
+ }, done).start();
+});
+
+
+gulp.task('tdd', function (done) {
+ new Server({
+ configFile: __dirname + '/karma.conf.js'
+ }, done).start();
+});
+
+gulp.task('babel', function () {
+ return gulp.src('./src/**/*.js')
+ .pipe(babel())
+ .pipe(gulp.dest('./lib'));
+});
+
+function inc(version) {
+ if (!version) return;
+
+ var type, tag;
+
+ if (version.indexOf('.') < 0) {
+ if (version === 'major' || version === 'minor' || version === 'patch') {
+ type = version;
+ } else {
+ tag = version;
+
+ var parts = pkg.version.split('-');
+ if (parts.length > 1) {
+ var tagVersion = 0;
+ var p = parts[1].split('.');
+ if (p[0] === tag) tagVersion = parseInt(p[1], 10) + 1;
+ version = parts[0] + '-' + tag + '.' + tagVersion;
+ } else {
+ version = pkg.version + '-' + tag + '.0';
+ }
+ }
+ }
+
+ function cb(obj) {
+ var stream = new require('stream').Transform({objectMode: true});
+ stream._transform = function(file, unused, callback) {
+ obj();
+ callback(null, file);
+ };
+ return stream;
+ }
+
+ // get all the files to bump version in
+ return gulp.src(['./package.json', './bower.json'])
+ // bump the version number in those files
+ .pipe(type ? bump({type: type}) : bump({version: version}))
+ // save it back to filesystem
+ .pipe(gulp.dest('./'))
+
+ // commit change
+ .pipe(git.commit('bumps package version'))
+
+ // read only one file to get the version number
+ .pipe(filter('package.json'))
+ // **tag it in the repository**
+ .pipe(tag_version({prefix: ''}))
+
+ // push tag
+ .pipe(prompt.confirm({
+ message: 'Push tag ' + version + ' to github?',
+ default: false
+ }))
+ .pipe(cb(function() {
+ git.push('origin','master', {args: ' --tags'}, function (err) {
+ if (err) throw err;
+ });
+ }))
+
+ // npm publish
+ .pipe(prompt.confirm({
+ message: 'publish ' + version + ' to npm?',
+ default: false
+ }))
+ .pipe(shell([
+ 'npm publish --tag ' + (tag ? tag : 'latest')
+ ]));
+}
+
+function watch() {
+ return compile(true);
+};
+
+gulp.task('concat', function() { return compile(); });
+gulp.task('watch', function() { return watch(); });
+gulp.task('bump', function() { return inc(argv.v); });
+
+gulp.task('default', ['watch']);
+gulp.task('build', ['concat', 'babel']);
+gulp.task('publish', ['bump']);
Oops, something went wrong.

0 comments on commit e1b4f59

Please sign in to comment.