Skip to content

Commit 51b603c

Browse files
committed
added: direct translation
1 parent 8acc484 commit 51b603c

11 files changed

Lines changed: 30 additions & 18 deletions

File tree

bin/total

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,13 @@ function main() {
617617
var content = fs.readFileSync(filename).toString('utf8');
618618
var command = Internal.findLocalization(content, 0);
619619
while (command !== null) {
620+
621+
// Skip for direct reading
622+
if (command.command[0] === '#' && command.command[1] !== ' ') {
623+
command = Internal.findLocalization(content, command.end);
624+
continue;
625+
}
626+
620627
var key = 'T' + command.command.hash();
621628
var file = filename.substring(root.length);
622629
texts[key] = command.command;

changes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ source-code: "tabs" instead of "spaces"
4040
- updated: framework.mail() --> returns MailMessage
4141
- updated: controller.mail() --> returns MailMessage
4242
- updated: SchemaBuilderEntity.$async(callback, [return-only-this-index])
43+
- updated: translation @(#KEY) (direct reading) or @(TEXT TO TRANSLATE) (hash reading)
4344

4445
- fixed: F.usage() --> fixed queue pendings
4546
- fixed: (CRITICAL) SchemaBuilderEntity preparing (problem with prototypes)

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function Framework() {
169169

170170
this.id = null;
171171
this.version = 1730;
172-
this.version_header = '1.7.3 (build: 30)';
172+
this.version_header = '1.7.3 (build: 31)';
173173

174174
var version = process.version.toString().replace('v', '').replace(/\./g, '');
175175

@@ -5787,7 +5787,7 @@ Framework.prototype.resource = function(name, key) {
57875787
};
57885788

57895789
/**
5790-
* Translate text
5790+
* Translates text
57915791
* @param {String} language A resource filename, optional.
57925792
* @param {String} text
57935793
* @return {String}
@@ -5799,6 +5799,9 @@ Framework.prototype.translate = function(language, text) {
57995799
language = undefined;
58005800
}
58015801

5802+
if (text[0] === '#' && text[1] !== ' ')
5803+
return this.resource(language, text.substring(1));
5804+
58025805
var value = this.resource(language, 'T' + text.hash());
58035806
if (!value)
58045807
return text;

minify/merged/total.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

minify/total.js/bin/total

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

minify/total.js/index.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

minify/total.js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@
6767
"scripts": {
6868
"test": "echo \"Error: no test specified\" && exit 1"
6969
},
70-
"version": "1.7.3-30"
70+
"version": "1.7.3-31"
7171
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@
6767
"scripts": {
6868
"test": "echo \"Error: no test specified\" && exit 1"
6969
},
70-
"version": "1.7.3-30"
70+
"version": "1.7.3-31"
7171
}

test/test-framework-debug.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ function test_routing(next) {
168168
utils.request(url + 'translate/?language=', 'GET', null, function(error, data, code, headers) {
169169
if (error)
170170
throw error;
171-
assert(data === '---translate---', 'translate problem (EN)');
171+
assert(data === '---translate---######', 'translate problem (EN)');
172172
utils.request(url + 'translate/?language=sk', 'GET', null, function(error, data, code, headers) {
173173
if (error)
174174
throw error;
175-
assert(data === '---preklad---', 'translate problem (SK)');
175+
assert(data === '---preklad---###preklad###', 'translate problem (SK)');
176176
complete();
177177
});
178178
});

test/test-framework-release.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ function test_routing(next) {
168168
utils.request(url + 'translate/?language=', 'GET', null, function(error, data, code, headers) {
169169
if (error)
170170
throw error;
171-
assert(data === '---translate---', 'translate problem (EN)');
171+
assert(data === '---translate---######', 'translate problem (EN)');
172172
utils.request(url + 'translate/?language=sk', 'GET', null, function(error, data, code, headers) {
173173
if (error)
174174
throw error;
175-
assert(data === '---preklad---', 'translate problem (SK)');
175+
assert(data === '---preklad---###preklad###', 'translate problem (SK)');
176176
complete();
177177
});
178178
});

0 commit comments

Comments
 (0)