-
Notifications
You must be signed in to change notification settings - Fork 28
Добавлены обратно совместимые изменения для работы с ns i18n #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 0.9
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,6 +124,42 @@ function translate(data) { | |
| } | ||
| } | ||
|
|
||
| function wrap(text) { | ||
| var node = stack[stack.length - 1], | ||
| parent = stack[stack.length - 2], | ||
| regex = /^data\-/, | ||
| params = {}; | ||
|
|
||
| if (!node || node.ns[node.prefix] !== fest_i18n_ns) { | ||
| return escapeHTML(text); | ||
| } | ||
|
|
||
| text = translate_message(new Message(text)); | ||
| text = 'i18n("' + text + '"'; | ||
|
|
||
| for (var key in node.attributes) { | ||
| if (regex.test(key)) { | ||
| params[key.replace(regex, '')] = node.attributes[key].value; | ||
| } | ||
| } | ||
|
|
||
| if (Object.keys(params).length) { | ||
| text += ',' + JSON.stringify(params); | ||
| } | ||
|
|
||
| if (node.attributes.context) { | ||
| text += ',' + '"' + node.attributes.context.value + '"'; | ||
| } | ||
|
|
||
| text += ')'; | ||
|
|
||
| if (parent && ['get', 'script', 'value'].indexOf(parent.local) === -1) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Вот тут я так на глаз накидал теги в которых контентная модель представлена js кодом. Если есть еще какие то блоки то нужно напишите. |
||
| text = '<fest:value>' + text + '</fest:value>'; | ||
| } | ||
|
|
||
| return text; | ||
| } | ||
|
|
||
| parser.onprocessinginstruction = function(instruction){ | ||
| result += '<?' + instruction.name + ' ' + instruction.body + '?>'; | ||
| }; | ||
|
|
@@ -178,7 +214,7 @@ function translate(data) { | |
| parser.ontext = function(text){ | ||
| var xml; | ||
| closetag(); | ||
| ontext(text, escapeHTML); | ||
| ontext(text, wrap); | ||
| }; | ||
|
|
||
| parser.oncdata = function(text){ | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,8 @@ | |
| </fest:set> | ||
| <fest:get name="block"> | ||
| { | ||
| text: '<i18n:msg>Строка</i18n:msg>' | ||
| text: <i18n:msg>Строка</i18n:msg> | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Вот здесь сломана обратная совместимость, но иначе ни как. |
||
| } | ||
| </fest:get> | ||
| </fest:template> | ||
|
|
||
| </fest:template> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Специально нет проверки на собственные свойства?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вобще наверно нет, а нужно ?