From 60850d5c48e960424075a173833eb14c1fff74a9 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 14 Jan 2014 10:29:23 -0800 Subject: [PATCH] Updated some tags. Added a script to copy tags from en.coffee. --- app/locale/en.coffee | 24 ++++++++++++++++++++++++ app/templates/modal/recover.jade | 6 +++--- app/templates/modal/save_version.jade | 21 +++++++++++---------- app/templates/modal/wizard_settings.jade | 4 ++-- scripts/copy-i18n-tags.coffee | 21 +++++++++++++++++++++ 5 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 scripts/copy-i18n-tags.coffee diff --git a/app/locale/en.coffee b/app/locale/en.coffee index 3ea17364f..cb43f4380 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -1,6 +1,8 @@ module.exports = nativeDescription: "English", englishDescription: "English", translation: common: loading: "Loading..." + saving: "Saving..." + sending: "Sending..." modal: close: "Close" @@ -33,14 +35,30 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr email: "Email" message: "Message" cancel: "Cancel" + save: "Save" + + versions: + save_version_title: "Save New Version" + commit_message: "Commit Message" + new_major_version: "New Major Version" + cla_prefix: "To save changes, first you must agree to our" + cla_url: "CLA" + cla_suffix: "." + cla_agree: "I AGREE" login: + login_modal_title: "Log In" log_in: "Log In" sign_up: "create new account" or: ", or " recover: "recover account" + recover: + recover_account_title: "Recover Account" + send_password: "Send Recovery Password" + signup: + create_account_title: "Create Account to Save Progress" description: "It's free. Just need a couple things and you'll be good to go:" email_announcements: "Receive announcements by email" coppa: "13+ or non-USA " @@ -91,6 +109,10 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr learn_more: "Learn more about being a Diplomat" subscribe_as_diplomat: "Subscribe as a Diplomat" + wizard_settings: + title: "Wizard Settings" + customize_avatar: "Customize Your Avatar" + account_settings: title: "Account Settings" not_logged_in: "Log in or create an account to change your settings." @@ -231,9 +253,11 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr level_components_type: "Type" level_component_edit_title: "Edit Component" level_system_edit_title: "Edit System" + create_system_title: "Create New System" create_system_field_name: "Name" create_system_btn_cancel: "Cancel" create_system_btn_create: "Create" + new_component_title: "Create New Component" new_component_field_system: "System" new_component_field_name: "Name" new_component_btn_cancel: "Cancel" diff --git a/app/templates/modal/recover.jade b/app/templates/modal/recover.jade index f8107354f..b956c4deb 100644 --- a/app/templates/modal/recover.jade +++ b/app/templates/modal/recover.jade @@ -6,13 +6,13 @@ block modal-header-content block modal-body-content .form-inline .control-group - label.control-label(for="recover-email") Email + label.control-label(for="recover-email", data-i18n="forms.email") Email .controls input#recover-email.input-large(name="email", type="email") block modal-body-wait-content - h3 Sending + h3(data-i18n="common.sending") Sending... block modal-footer .modal-footer - button.btn.btn-primary.btn-large#recover-button Send Recover Password + button.btn.btn-primary.btn-large#recover-button(data-i18n="recover.send_password") Send Recovery Password diff --git a/app/templates/modal/save_version.jade b/app/templates/modal/save_version.jade index 14c29b20b..c7592ba76 100644 --- a/app/templates/modal/save_version.jade +++ b/app/templates/modal/save_version.jade @@ -1,29 +1,30 @@ extends /templates/modal/modal_base block modal-header-content - h3(data-i18n="save.save_version_title") Save New Version + h3(data-i18n="versions.save_version_title") Save New Version block modal-body-content form.form-horizontal .control-group - label.control-label(for="commitMessage") Commit Message + label.control-label(for="commitMessage", data-i18n="versions.commit_message") Commit Message .controls textarea#commit-message.input-large(name="commitMessage", type="text") .control-group - label.control-label(for="level-version-is-major") New Major Version + label.control-label(for="level-version-is-major", data-i18n="versions.new_major_version") New Major Version .controls input#major-version.input-large(name="version-is-major", type="checkbox") span.help-block block modal-body-wait-content - h3 Saving... + h3(data-i18n="common.saving") Saving... block modal-footer-content #accept-cla-wrapper.alert.alert-info - | To save changes, first you must agree to - strong#cla-link our CLA - | . - button.btn#agreement-button I AGREE + span(data-i18n="versions.cla_prefix") To save changes, first you must agree to our + | + strong#cla-link(data-i18n="versions.cla_url") CLA + span(data-i18n="versions.cla_suffix") . + button.btn#agreement-button(data-i18n="versions.cla_agree") I AGREE - button.btn(data-dismiss="modal") Cancel - button.btn.btn-primary#save-version-button Save + button.btn(data-dismiss="modal", data-i18n="forms.cancel") Cancel + button.btn.btn-primary#save-version-button(data-i18n="forms.save") Save diff --git a/app/templates/modal/wizard_settings.jade b/app/templates/modal/wizard_settings.jade index 3fcb6c4dd..86c5c463e 100644 --- a/app/templates/modal/wizard_settings.jade +++ b/app/templates/modal/wizard_settings.jade @@ -1,10 +1,10 @@ extends /templates/modal/modal_base block modal-header-content - h3(data-i18n="modal.wizard_settings_title") Wizard Settings + h3(data-i18n="wizard_settings.title") Wizard Settings block modal-body-content - h4 Customize Your Avatar + h4(data-i18n="wizard_settings.customize_avatar") Customize Your Avatar canvas(width="120px", height="150px") .settings diff --git a/scripts/copy-i18n-tags.coffee b/scripts/copy-i18n-tags.coffee new file mode 100644 index 000000000..21251ad44 --- /dev/null +++ b/scripts/copy-i18n-tags.coffee @@ -0,0 +1,21 @@ +fs = require 'fs' +en = require('app/locale/en').translation +dir = fs.readdirSync 'app/locale' +for file in dir when not (file in ['locale.coffee', 'en.coffee']) + contents = require('app/locale/' + file) + categories = contents.translation + lines = ["module.exports = nativeDescription: \"#{contents.nativeDescription}\", englishDescription: \"#{contents.englishDescription}\", translation:"] + first = true + for enCat, enTags of en + catMissing = not categories[enCat] + cat = (categories[enCat] ?= {}) + lines.push "" unless first # blank lines between categories + lines.push "#{if catMissing then '#' else ''} #{enCat}:" + first = false + for enTag, enString of enTags + tagMissing = not cat[enTag] + tag = (cat[enTag] ?= enString) + tag = tag.replace /"/g, '\\"' + lines.push "#{if tagMissing then '#' else ''} #{enTag}: \"#{tag}\"" + newContents = lines.join('\n') + '\n' + fs.writeFileSync 'app/locale/' + file, newContents