From 4f11896ded49a001f4bec2c34b7af595e9f85b95 Mon Sep 17 00:00:00 2001 From: Dmitry Chleck Date: Sun, 20 Jan 2013 01:22:53 +0400 Subject: [PATCH] Remove version from header's comments. --- .gitignore | 1 + README.md | 28 ++++++++++++++-------------- example/deferred.js | 3 +-- example/i18n/ru.tr | 8 ++++---- example/translate.js | 1 - index.js | 1 - lib/i18n.js | 6 ++---- test/test.js | 9 ++++----- 8 files changed, 26 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 944f6fb..11bcfb0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +test/npm-debug.log node_modules/ locale.* TODO.md diff --git a/README.md b/README.md index 6178028..c61a1a3 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ * Plural forms for any language * Simultaneous support of multiple languages * Flexible placeholders -* Remote translation +* Deferred translation ## It's simple --- @@ -44,7 +44,7 @@ See [locale-tools project](https://github.com/chleck/locale-tools "Tools for loc - [Translation target](#translation-target) - [Translation](#translation) - [Strings format](#strings-format) -- [Remote translation](#remote-translation) +- [Deferred translation](#deferred-translation) ## Library import --- @@ -107,7 +107,7 @@ new locale.i18n(target) , where *target* (string or null) - 1) id of the target language, 2) empty string or 3) null. Sets target language to base language if *target* is *''* (empty string). -Enables remote translation mode if *target* is *null*. +Enables deferred translation mode if *target* is *null*. ### Example: ```javascript @@ -115,7 +115,7 @@ Enables remote translation mode if *target* is *null*. var i18n = new locale.i18n('ru'); // Create translation object for base language (no translation) var i18n = new locale.i18n(''); -// Create translation object for remote translation +// Create translation object for deferred translation var i18n = new locale.i18n(null); // And pull up __() function to the local scope var __ = i18n.__; @@ -138,7 +138,7 @@ to(target) , where *target* (string or null) - 1) id of target language, 2) empty string or 3) null. Sets target language to base language if *target* is *''* (empty string). -Switches i18n object to remote translation mode if *target* is *null*. +Switches i18n object to deferred translation mode if *target* is *null*. ### Example: ```javascript @@ -147,7 +147,7 @@ locale.to('de'); // Create i18n object and set its target language to Russian var i18n = new locale.i18n(); i18n.to('ru'); -// Enable remote translation mode +// Enable deferred translation mode i18n.to(null); ``` ## Translation @@ -169,7 +169,7 @@ __(phrase, object) - *array* (Array) - array of args; - *object* (object) - map of args. -Returns translated string or remote translation data (in case of remote translation target). +Returns translated string or deferred translation data (in case of deferred translation target). ### For plural form: ```javascript @@ -186,7 +186,7 @@ __(phrase, n, object) - *array* (Array) - array of args; - *object* (object) - map of args. -Returns translated string or remote translation data (in case of remote translation target). +Returns translated string or deferred translation data (in case of deferred translation target). ### Example: ```javascript @@ -218,12 +218,12 @@ __([ '%(login)s, you have %n unreaded messages in the "%(folder)s" folder.' ], 365, { login: 'Anonymous', folder: 'Spam' }); -// Remote: +// Deferred: // { __i18n: true, phrase: 'Hello!', n: undefined, args: {} } __('Hello!'); ``` -See also: [Remote translation](#remote-translation). +See also: [Deferred translation](#deferred-translation). ## Strings format --- @@ -325,16 +325,16 @@ __('%s%%', 40); __('It\'s ## not a comment!); ``` -## Remote translation +## Deferred translation --- -### Search for remote translation data in the *obj* and replace it by translated string: +### Search for deferred translation data in the *obj* and replace it by translated string: ```javascript i18n.tr(obj) ``` , where *obj* (object) - object for translation. -### Remote translation data structure: +### Deferred translation data structure: ``` { __i18n: true, @@ -349,7 +349,7 @@ See also: [Creating i18n object](#creating-i18n-object). ```javascript // Server: -// Create i18n object for the remote mode +// Create i18n object for the deferred mode var i18n = new locale.i18n(null); var __ = i18n.__; submit({ diff --git a/example/deferred.js b/example/deferred.js index 18ec0da..a41bde3 100644 --- a/example/deferred.js +++ b/example/deferred.js @@ -1,10 +1,9 @@ /* - * # locale library usage examples: remote translation + * # locale library usage examples: deferred translation * * ## locale.js: i18n for Node.js and browser * * @author Dmitry A. Chleck - * @version 1.1.0 * @url https://github.com/chleck/locale-js */ diff --git a/example/i18n/ru.tr b/example/i18n/ru.tr index 1bb1305..1d7bc21 100644 --- a/example/i18n/ru.tr +++ b/example/i18n/ru.tr @@ -1,5 +1,5 @@ -@ [1] remote.js (24:15) -@ [2] remote.js (26:17) +@ [1] deferred.js (24:15) +@ [2] deferred.js (26:17) @ [3] translate.js (37:6) @ [4] translate.js (39:6) S Hello! @@ -7,7 +7,7 @@ S Hello! ? Hello! ! Привет! -@ [1] remote.js (25:13) +@ [1] deferred.js (25:13) P The following error occurred during processing: ? The following error occurred during processing: ? The following errors occurred during processing: @@ -15,7 +15,7 @@ P The following error occurred during processing: ! Во время обработки возникли следующие ошибки: ! Во время обработки возникли следующие ошибки: -@ [1] remote.js (26:31) +@ [1] deferred.js (26:31) S Email %s is invalid. Please enter valid email. ? Email %s is invalid. Please enter valid email. ! Недопустимый email %s. Пожалуйста, введите правильный email. diff --git a/example/translate.js b/example/translate.js index b607f7e..1b78c60 100644 --- a/example/translate.js +++ b/example/translate.js @@ -4,7 +4,6 @@ * ## locale.js: i18n for Node.js and browser * * @author Dmitry A. Chleck - * @version 1.1.0 * @url https://github.com/chleck/locale-js */ diff --git a/index.js b/index.js index 3ff545d..14ee95f 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,6 @@ * ## locale.js: i18n for Node.js and browser * * @author Dmitry A. Chleck - * @version 1.1.0 * @url https://github.com/chleck/locale-js */ diff --git a/lib/i18n.js b/lib/i18n.js index ec9df25..89dadea 100644 --- a/lib/i18n.js +++ b/lib/i18n.js @@ -4,7 +4,6 @@ * ## locale.js: i18n for Node.js and browser * * @author Dmitry A. Chleck - * @version 1.1.0 * @url https://github.com/chleck/locale-js */ @@ -93,11 +92,11 @@ var locale = new function() { a = a[0]; } var json = { '__i18n': true, 'phrase': phrase, 'n': n, 'args': a }; - // Check remote mode + // Check deferred mode return to === null ? json : translate(json, to); } - // # Translate remote objects + // # Translate deferred objects this.tr = function(obj) { if(typeof obj !== 'object') return; for(var o in obj) { @@ -139,7 +138,6 @@ var locale = new function() { } } } - //return fill(result, args.args, args.n); return sprintf(result, args.args, args.n); } diff --git a/test/test.js b/test/test.js index bc234eb..98f9cda 100644 --- a/test/test.js +++ b/test/test.js @@ -4,7 +4,6 @@ * ## locale.js: i18n for Node.js and browser * * @author Dmitry A. Chleck - * @version 1.1.0 * @url https://github.com/chleck/locale-js */ @@ -36,7 +35,7 @@ describe('Test suite for locale library', function() { i18n = new locale.i18n(); }) - it('Create i18n object for remote translation', function() { + it('Create i18n object for deferred translation', function() { i18n = new locale.i18n(null); }) @@ -314,14 +313,14 @@ describe('Test suite for locale library', function() { }) - describe('Remote translation:', function() { + describe('Deferred translation:', function() { - it('Turn on remote translation mode', function() { + it('Turn on deferred translation mode', function() { locale.to(null); __ = locale.__; }) - it('Create object containing remote translation data', function() { + it('Create object containing deferred translation data', function() { tmp = { data: 'Some data...', array: [ 1, 2, 3, 4, 5 ],