Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
Merge pull request #29 from diox/handle-nulls-in-translations
Browse files Browse the repository at this point in the history
Handle null values in translations (bug 984422)
  • Loading branch information
diox committed Mar 27, 2014
2 parents 8709a68 + a2cdf17 commit 8a4a466
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/media/js/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ define('forms', ['jquery', 'l10n', 'z'], function($, l10n, z) {
var translated_fields = $('input[type=translated], textarea[translated]');
translated_fields.each(function(i, elem) {
var $elem = $(elem);
var values = $elem.data('value');
var values = $elem.data('value') || {};
var locale_picker = $('<select class="locale">');
for (var locale in values) {
locale_picker.append('<option>' + locale + '</option>');
Expand All @@ -83,7 +83,7 @@ define('forms', ['jquery', 'l10n', 'z'], function($, l10n, z) {

function save() {
var $elem = $(elem); // Get a new reference!
var data = $elem.data('value');
var data = $elem.data('value') || {};
// Save the old value.
data[previous_value] = $elem.val();
$elem.data(data);
Expand Down
4 changes: 2 additions & 2 deletions src/templates/collection.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<h1>
<div class="fat field" data-field="name">
<p>{{ this.name|translate(this) }}</p>
<form><input type="translated" required data-value="{{ this.name|stringify|escape }}" pattern="[^\s].*|\s+\S.+"></form>
<form><input type="translated" required data-value="{{ (this.name or {})|stringify|escape }}" pattern="[^\s].*|\s+\S.+"></form>
</div>
</h1>
{% if this.author and this.author != 'nobody' %}
Expand Down Expand Up @@ -53,7 +53,7 @@ <h1>
<div class="text field" data-field="description">
<label>{{ _('Description:') }}</label>
<p>{{ this.description|translate(this) }}</p>
<form><textarea translated data-value="{{ this.description|stringify|escape }}" pattern="[^\s].*|\s+\S.+"></textarea></form>
<form><textarea translated data-value="{{ (this.description or {})|stringify|escape }}" pattern="[^\s].*|\s+\S.+"></textarea></form>
</div>
</div>
{# Curated collection customization fields #}
Expand Down

0 comments on commit 8a4a466

Please sign in to comment.