Permalink
Browse files

Progress on front-end i18n.

  • Loading branch information...
1 parent 17bca60 commit bf0306d648a50a4093ff95dc9b271f424549065d @onyxfish onyxfish committed with jywsn Aug 29, 2012
@@ -6,6 +6,7 @@ PANDA.API = "/api/1.0";
PANDA.collections = {};
PANDA.models = {};
PANDA.views = {};
+PANDA.text = {};
PANDA.routers = {};
PANDA.templates = {};
PANDA.errors = {};
@@ -0,0 +1,11 @@
+PANDA.text.Activate = function() {
+ return {
+ activate_title: gettext("Activate your PANDA account"),
+ email: gettext("Email"),
+ first_name: gettext("First name"),
+ last_name: gettext("Last name"),
+ password: gettext("Password"),
+ password2: gettext("Re-enter password"),
+ activate: gettext("Activate")
+ }
+}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,8 @@
+PANDA.text.Home = function() {
+ return {
+ recently_added_datasets: gettext("Recently added datasets"),
+ created_timestamp: gettext("Created %(timeago)s"),
+ browse_all_datasets: gettext("Browse all %(count)s datasets"),
+ dashboard_link: gettext("Want to see how your PANDA is being used? Visit the <a %(link)s>Dashboard</a>!")
+ }
+}
@@ -5,6 +5,8 @@ PANDA.views.Activate = Backbone.View.extend({
activation_key: null,
+ text: PANDA.text.Activate(),
+
initialize: function() {
_.bindAll(this);
},
@@ -27,16 +29,17 @@ PANDA.views.Activate = Backbone.View.extend({
try {
errors = $.parseJSON(xhr.responseText);
} catch(e) {
- errors = { "__all__": "Unknown error" };
+ errors = { "__all__": gettext("Unknown error") };
}
- $("#activation-form").show_errors(errors, "Activation failed!");
+ $("#activation-form").show_errors(errors, gettext("Activation failed!"));
}, this)
});
},
render: function(data) {
var context = PANDA.utils.make_context(data)
+ context.text = this.text;
this.$el.html(PANDA.templates.activate(context));
},
@@ -45,22 +48,22 @@ PANDA.views.Activate = Backbone.View.extend({
var errors = {};
if (!data["email"]) {
- errors["email"] = ["This field is required."]
+ errors["email"] = [gettext("This field is required.")]
}
if (!data["password"]) {
- errors["password"] = ["This field is required."]
+ errors["password"] = [gettext("This field is required.")]
}
if (!data["reenter_password"]) {
- errors["reenter_password"] = ["This field is required."]
+ errors["reenter_password"] = [gettext("This field is required.")]
}
if (data["password"] != data["reenter_password"]) {
if ("password" in errors || "reenter_password" in errors) {
// Skip
} else {
- errors["reenter_password"] = ["Passwords do not match."]
+ errors["reenter_password"] = [gettext("Passwords do not match.")]
}
}
@@ -71,7 +74,7 @@ PANDA.views.Activate = Backbone.View.extend({
var errors = this.validate();
if (!_.isEmpty(errors)) {
- $("#activation-form").show_errors(errors, "Activation failed!");
+ $("#activation-form").show_errors(errors, gettext("Activation failed!"));
return false;
}
@@ -96,10 +99,10 @@ PANDA.views.Activate = Backbone.View.extend({
try {
errors = $.parseJSON(xhr.responseText);
} catch(e) {
- errors = { "__all__": "Unknown error" };
+ errors = { "__all__": gettext("Unknown error") };
}
- $("#activation-form").show_errors(errors, "Activation failed!");
+ $("#activation-form").show_errors(errors, gettext("Activation failed!"));
}
});
@@ -31,6 +31,8 @@ PANDA.views.DataUpload = Backbone.View.extend({
allowed_extensions: ["csv", "xls", "xlsx"],
+ text: PANDA.text.DataUpload(),
+
initialize: function() {
_.bindAll(this);
},
@@ -88,6 +90,7 @@ PANDA.views.DataUpload = Backbone.View.extend({
});
var context = PANDA.utils.make_context({
+ text: this.text,
dataset: dataset_json,
available_space: this.available_space,
all_categories: all_categories
@@ -3,12 +3,7 @@ PANDA.views.Home = Backbone.View.extend({
_.bindAll(this);
},
- text: {
- recently_added_datasets: gettext("Recently added datasets"),
- created_timestamp: gettext("Created %(timeago)s"),
- browse_all_datasets: gettext("Browse all %(count)s datasets"),
- dashboard_link: gettext("Want to see how your PANDA is being used? Visit the <a %(link)s>Dashboard</a>!")
- },
+ text: PANDA.text.Home(),
render: function() {
var recent_datasets = new PANDA.collections.Datasets()
@@ -19,17 +19,12 @@ PANDA.views.SearchResults = Backbone.View.extend({
export_body: gettext("<p>This may take a long time to complete. You will be notified when it is finished.</p><p>Please note that changes made to the data during export may not be accurately reflected.</p>"),
export_cancel: gettext("Cancel"),
export_continue: gettext("Continue with export"),
- export_success_email: gettext("Your export has been successfully queued. When it is complete you will be emailed a link to download the file."),
- export_success_no_email: gettext("Your export has been successfully queued. Your PANDA does not have email configured, so you will need to check your Notifications list to see when it is ready to be downloaded."),
- export_failure: gettext("<p>Your export failed to start!</p><p>Error:</p><code>%(traceback)s</code>"),
subscribe_title: gettext("Subscribe to this search?"),
subscribe_body_email: gettext("When you click <strong>Subscribe</strong> you will begin receiving daily email notifications of new data added to PANDA that matches your search."),
subscribe_body_no_email: gettext("When you click <strong>Subscribe</strong> you will begin receiving daily notifications of new data added to PANDA that matches your search."),
subscribe_cancel: gettext("Cancel"),
- subscribe_continue: gettext("Subscribe"),
- subscribe_success: gettext("<p>You will now receive notifications for this search.</p><p>You cancel these notifications on your user page.</p>"),
- subscribe_failure: gettext("<p>Failed to subscribe to notifications!</p><p>Error:</p><code>%(traceback)s</code>")
+ subscribe_continue: gettext("Subscribe")
},
text_makers: {
@@ -100,11 +95,11 @@ PANDA.views.SearchResults = Backbone.View.extend({
sub.save({}, {
async: false,
success: _.bind(function(model, response) {
- bootbox.alert(this.text.subscribe_success);
+ bootbox.alert(gettext("<p>You will now receive notifications for this search.</p><p>You cancel these notifications on your user page.</p>"));
}, this),
error: function(model, response) {
error = JSON.parse(response);
- bootbox.alert(interpolate(this.text.subscribe_failure, { traceback: error.traceback }, true));
+ bootbox.alert(interpolate(gettext("<p>Failed to subscribe to notifications!</p><p>Error:</p><code>%(traceback)s</code>"), { traceback: error.traceback }, true));
}
});
},
@@ -119,15 +114,15 @@ PANDA.views.SearchResults = Backbone.View.extend({
this.search.since,
function() {
if (PANDA.settings.EMAIL_ENABLED) {
- note = this.text.export_success_email;
+ note = gettext("Your export has been successfully queued. When it is complete you will be emailed a link to download the file.");
} else {
- note = this.text.export_success_no_email;
+ note = gettext("Your export has been successfully queued. Your PANDA does not have email configured, so you will need to check your Notifications list to see when it is ready to be downloaded.");
}
bootbox.alert(note);
},
function(error) {
- bootbox.alert(interpolate(this.text.export_failure, { traceback: error.traceback }, true));
+ bootbox.alert(interpolate(gettext("<p>Your export failed to start!</p><p>Error:</p><code>%(traceback)s</code>"), { traceback: error.traceback }, true));
}
);
}
@@ -2,39 +2,39 @@
<div id="activate">
<form id="activation-form">
<img src="<%= PANDA.settings.STATIC_URL %>img/panda_and_ire.png" />
- <h2>Activate your PANDA account</h2>
+ <h2><%= text.activate_title %></h2>
<div class="alert"></div>
<% if (typeof(email) !== 'undefined') { %>
<fieldset>
<div class="control-group">
- <label for="email">Email</label>
+ <label for="email"><%= text.email %></label>
<input type="text" name="email" value="<%= email %>" />
<span class="help-inline"></span>
</div>
<div class="control-group">
- <label for="first_name">First name</label>
+ <label for="first_name"><%= text.first_name %></label>
<input type="text" name="first_name" value="<%= first_name %>" />
<span class="help-inline"></span>
</div>
<div class="control-group">
- <label for="last_name">Last name</label>
+ <label for="last_name"><%= text.last_name %></label>
<input type="text" name="last_name" value="<%= last_name %>" />
<span class="help-inline"></span>
</div>
<input type="hidden" name="activation_key" value="<%= activation_key %>" />
</fieldset>
<fieldset>
<div class="control-group">
- <label for="password">Password</label>
+ <label for="password"><%= text.password %></label>
<input type="password" name="password" />
<span class="help-inline"></span>
</div>
<div class="control-group">
- <label for="reenter_password">Re-enter password</label>
+ <label for="reenter_password"><%= text.password2 %></label>
<input type="password" name="reenter_password" />
<span class="help-inline"></span>
</div>
- <input type="submit" class="btn primary" value="Activate" />
+ <input type="submit" class="btn primary" value="<%= text.activate %>" />
</fieldset>
<% } %>
</form>
Oops, something went wrong.

0 comments on commit bf0306d

Please sign in to comment.