data-l10n-id attribute does not work inside <template> tag

RESOLVED INCOMPLETE

Status

Add-on SDK
General
P2
normal
RESOLVED INCOMPLETE
3 years ago
2 months ago

People

(Reporter: Michał Turek, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0
Build ID: 20150401154227

Steps to reproduce:

I'm developing Firefox extension using add-on SDK
I'm following this documentation
https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/l10n#Using_Localized_Strings_in_HTML
Here is simplified test case:

			<table class="table">
				<thead class="thead">
				<tr>
					<th class="idx"></th>
					<th class="countrycode" data-l10n-id="country">Country</th>
					<th class="proxylabel" data-l10n-id="proxylabel">Label</th>
					<th class="ip" data-l10n-id="proxy_ip">Proxy IP</th>
					<th class="actions"></th>
				</tr>
				</thead>
				<tbody class="tbody">
				<template id="proxy_row_template">
					<tr class="tr">
						<td class="idx"></td>
						<td class="countrycode"><img class="flag" src="img/flags/unknown.png"></td>
						<td class="proxylabel" data-l10n-id="no_label">No label</td>
						<td class="ip"></td>
						<td class="actions">
							<a class="btn btn-default btn-small edit_proxy" href="#"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span><span data-l10n-id="edit">Edit</span></a>
							<a class="btn btn-default btn-small delete" href="#"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span><span data-l10n-id="remove">Remove</span></a>
						</td>
					</tr>
				</template>
				</tbody>
			</table>
<script>
var template_clone = $($('#proxy_row_template').html().trim());
$('.tbody').append(template_clone);
</script>




Actual results:

Content of <th> tags was translated successfully
Content of <td> tags was not translated




Expected results:

Content of <td> tags should be translated
data-l10n-id attribute seems to not work when inside of <template> tag

Updated

3 years ago
Component: Untriaged → General
Product: Firefox → Add-on SDK
Version: 31 Branch → unspecified
Priority: -- → P2
Blocks: 958990
Whiteboard: [good first bug]
Confirming, this is something I noticed a while ago as well. Contents of the <template> tag are removed from the document earlier than the l10n data is being applied, so they stay untranslated.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 2

10 months ago
Because of the difficulty finding mentors and the expected life span of the SDK, we are removing [good first bug] from remaining SDK bugs.

Updated

10 months ago
Whiteboard: [good first bug]
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: NEW → RESOLVED
Last Resolved: 2 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.