Fix html attr translation

pull/1297/head
Marcel Klehr 2012-12-23 16:31:50 +01:00
parent 04b65a0b4e
commit fdf6628cc5
4 changed files with 28 additions and 27 deletions

View File

@ -48,7 +48,7 @@ pad.importExport.abiword.innerHTML = You only can import from plain text or html
pad.modals.connected = Connected.
pad.modals.reconnecting = Reconnecting to your pad..
pad.modals.forcereconnect = Force reconnect
pad.modals.uderdup = Opened in another window
pad.modals.userdup = Opened in another window
pad.modals.userdup.explanation = This pad seems to be opened in more than one browser window on this computer.
pad.modals.userdup.advice = Reconnect to use this window instead.
pad.modals.unauth = Not authorized

View File

@ -735,7 +735,8 @@ window.html10n = (function(window, document, undefined) {
// get id
str.id = node.getAttribute('data-l10n-id')
if (!str.id) return
if(!translations[str.id]) return
if(!translations[str.id]) return consoleWarn('Couldn\'t find translation key '+str.id)
// get args
if(window.JSON) {
@ -750,6 +751,7 @@ window.html10n = (function(window, document, undefined) {
str.str = html10n.get(str.id, str.args)
// get attribute name to apply str to
var prop
, index = str.id.lastIndexOf('.')
, attrList = // allowed attributes
@ -758,7 +760,6 @@ window.html10n = (function(window, document, undefined) {
, "alt": 1
, "textContent": 1
}
// get attribute name to apply str to
if (index > 0 && str.id.substr(index + 1) in attrList) { // an attribute has been specified
prop = str.id.substr(index + 1)
} else { // no attribute: assuming text content by default
@ -766,7 +767,7 @@ window.html10n = (function(window, document, undefined) {
}
// Apply translation
if (node.children.length === 0) {
if (node.children.length === 0 || prop != 'textContent') {
node[prop] = str.str
} else {
var children = node.childNodes,

View File

@ -54,60 +54,60 @@
<ul class="menu_left">
<% e.begin_block("editbarMenuLeft"); %>
<li class="acl-write" id="bold" data-key="bold">
<a class="grouped-left" data-l10n-id="pad.toolbar.bold">
<a class="grouped-left" data-l10n-id="pad.toolbar.bold.title">
<span class="buttonicon buttonicon-bold"></span>
</a>
</li>
<li class="acl-write" id="italic" data-key="italic">
<a class="grouped-middle" data-l10n-id="pad.toolbar.italic">
<a class="grouped-middle" data-l10n-id="pad.toolbar.italic.title">
<span class="buttonicon buttonicon-italic"></span>
</a>
</li>
<li class="acl-write" id="underline" data-key="underline">
<a class="grouped-middle" data-l10n-id="pad.toolbar.underline">
<a class="grouped-middle" data-l10n-id="pad.toolbar.underline.title">
<span class="buttonicon buttonicon-underline"></span>
</a>
</li>
<li class="acl-write" id="strikethrough" data-key="strikethrough">
<a class="grouped-right" data-l10n-id="pad.toolbar.strikethrough">
<a class="grouped-right" data-l10n-id="pad.toolbar.strikethrough.title">
<span class="buttonicon buttonicon-strikethrough"></span>
</a>
</li>
<li class="acl-write separator"></li>
<li class="acl-write" id="oderedlist" data-key="insertorderedlist">
<a class="grouped-left" data-l10n-id="pad.toolbar.ol">
<a class="grouped-left" data-l10n-id="pad.toolbar.ol.title">
<span class="buttonicon buttonicon-insertorderedlist"></span>
</a>
</li>
<li class="acl-write" id="unoderedlist" data-key="insertunorderedlist">
<a class="grouped-middle" data-l10n-id="pad.toolbar.ul">
<a class="grouped-middle" data-l10n-id="pad.toolbar.ul.title">
<span class="buttonicon buttonicon-insertunorderedlist"></span>
</a>
</li>
<li class="acl-write" id="indent" data-key="indent">
<a class="grouped-middle" data-l10n-id="pad.toolbar.indent">
<a class="grouped-middle" data-l10n-id="pad.toolbar.indent.title">
<span class="buttonicon buttonicon-indent"></span>
</a>
</li>
<li class="acl-write" id="outdent" data-key="outdent">
<a class="grouped-right" data-l10n-id="pad.toolbar.unindent">
<a class="grouped-right" data-l10n-id="pad.toolbar.unindent.title">
<span class="buttonicon buttonicon-outdent"></span>
</a>
</li>
<li class="acl-write separator"></li>
<li class="acl-write" id="undo" data-key="undo">
<a class="grouped-left" data-l10n-id="pad.toolbar.undo">
<a class="grouped-left" data-l10n-id="pad.toolbar.undo.title">
<span class="buttonicon buttonicon-undo"></span>
</a>
</li>
<li class="acl-write" id="redo" data-key="redo">
<a class="grouped-right" data-l10n-id="pad.toolbar.redo">
<a class="grouped-right" data-l10n-id="pad.toolbar.redo.title">
<span class="buttonicon buttonicon-redo"></span>
</a>
</li>
<li class="acl-write separator"></li>
<li class="acl-write" id="clearAuthorship" data-key="clearauthorship">
<a data-l10n-id="pad.toolbar.clearAuthorship">
<a data-l10n-id="pad.toolbar.clearAuthorship.title">
<span class="buttonicon buttonicon-clearauthorship"></span>
</a>
</li>
@ -116,34 +116,34 @@
<ul class="menu_right">
<% e.begin_block("editbarMenuRight"); %>
<li data-key="import_export">
<a class="grouped-left" id="importexportlink" data-l10n-id="pad.toolbar.import_export">
<a class="grouped-left" id="importexportlink" data-l10n-id="pad.toolbar.import_export.title">
<span class="buttonicon buttonicon-import_export"></span>
</a>
</li>
<li onClick="document.location = document.location.pathname+ '/timeslider'">
<a id="timesliderlink" class="grouped-middle" data-l10n-id="pad.toolbar.timeslider">
<a id="timesliderlink" class="grouped-middle" data-l10n-id="pad.toolbar.timeslider.title">
<span class="buttonicon buttonicon-history"></span>
</a>
</li>
<li class="acl-write" data-key="savedRevision">
<a class="grouped-right" id="revisionlink" data-l10n-id="pad.toolbar.savedRevision">
<a class="grouped-right" id="revisionlink" data-l10n-id="pad.toolbar.savedRevision.title">
<span class="buttonicon buttonicon-savedRevision"></span>
</a>
</li>
<li class="acl-write separator"></li>
<li class="acl-write" data-key="settings">
<a class="grouped-left" id="settingslink" data-l10n-id="pad.toolbar.settings">
<a class="grouped-left" id="settingslink" data-l10n-id="pad.toolbar.settings.title">
<span class="buttonicon buttonicon-settings"></span>
</a>
</li>
<li data-key="embed">
<a class="grouped-right" id="embedlink" data-l10n-id="pad.toolbar.embed">
<a class="grouped-right" id="embedlink" data-l10n-id="pad.toolbar.embed.title">
<span class="grouped-right buttonicon buttonicon-embed"></span>
</a>
</li>
<li class="separator"></li>
<li id="usericon" data-key="showusers">
<a data-l10n-id="pad.toolbar.showusers">
<a data-l10n-id="pad.toolbar.showusers.title">
<span class="buttonicon buttonicon-showusers"></span>
<span id="online_count">1</span>
</a>
@ -253,7 +253,7 @@
<div class="column acl-write">
<% e.begin_block("importColumn"); %>
<h2 data-l10n-id="pad.importExport.import"></h2>
<div class="importmessage" id="importmessageabiword" data-l10n-id="pad.importExport.abiword"></div><br>
<div class="importmessage" id="importmessageabiword" data-l10n-id="pad.importExport.abiword.innerHTML"></div><br>
<form id="importform" method="post" action="" target="importiframe" enctype="multipart/form-data">
<div class="importformdiv" id="importformfilediv">
<input type="file" name="file" size="10" id="importfileinput">
@ -295,9 +295,9 @@
<p><img alt="" border="0" src="../static/img/connectingbar.gif" /></p>
</div>
<div class="userdup">
<h1 data-l10n-id="pad.modals.uderdup"></h1>
<h1 data-l10n-id="pad.modals.userdup"></h1>
<h2 data-l10n-id="pad.modals.userdup.explanation"></h2>
<p data-l10n-id="pad.modals.connected.advice"></p>
<p data-l10n-id="pad.modals.userdup.advice"></p>
<button id="forcereconnect" data-l10n-id="pad.modals.forcereconnect"></button>
</div>
<div class="unauth">
@ -360,7 +360,7 @@
<div id="chatthrob"></div>
<div id="chaticon" data-l10n-id="pad.chat" onclick="chat.show();return false;">
<div id="chaticon" onclick="chat.show();return false;">
<span id="chatlabel" data-l10n-id="pad.chat"></span>
<span class="buttonicon buttonicon-chat"></span>
<span id="chatcounter">0</span>

View File

@ -116,9 +116,9 @@
<p><img alt="" border="0" src="../../static/img/connectingbar.gif" /></p>
</div>
<div class="userdup">
<h1 data-l10n-id="pad.modals.uderdup"></h1>
<h1 data-l10n-id="pad.modals.userdup"></h1>
<h2 data-l10n-id="pad.modals.userdup.explanation"></h2>
<p data-l10n-id="pad.modals.connected.advice"></p>
<p data-l10n-id="pad.modals.userdup.advice"></p>
<button id="forcereconnect" data-l10n-id="pad.modals.forcereconnect"></button>
</div>
<div class="unauth">