diff --git a/src/app.js b/src/app.js index 68c6bde6..c3545d72 100644 --- a/src/app.js +++ b/src/app.js @@ -54,6 +54,14 @@ App.getLocales = function() { }; +/** + * @return {string} default locale + */ +App.getDefaultUILocale = function() { + return App.DEFAULT_LOCALE; +}; + + /** * @return {string} browser locale */ diff --git a/src/app/core/multipleshapeshelper.js b/src/app/core/multipleshapeshelper.js index 3936dec8..22ef1470 100644 --- a/src/app/core/multipleshapeshelper.js +++ b/src/app/core/multipleshapeshelper.js @@ -1147,6 +1147,8 @@ thin.core.MultipleShapesHelper.prototype.createPropertyComponent_ = function() { var baseFormatInputProperty = new thin.ui.PropertyPane.InputProperty(thin.t('field_basic_format')); var baseFormatInput = baseFormatInputProperty.getValueControl(); + baseFormatInput.setTooltip(thin.t('text_placeholder_of_base_format_description')); + baseFormatInputProperty.addEventListener(propEventType.CHANGE, function(e) { var formatBase = e.target.getValue(); diff --git a/src/app/core/tblockshape.js b/src/app/core/tblockshape.js index 831415a9..3d1cf11e 100644 --- a/src/app/core/tblockshape.js +++ b/src/app/core/tblockshape.js @@ -1317,6 +1317,8 @@ thin.core.TblockShape.prototype.createPropertyComponent_ = function() { var baseFormatInputProperty = new thin.ui.PropertyPane.InputProperty(thin.t('field_basic_format')); var baseFormatInput = baseFormatInputProperty.getValueControl(); + baseFormatInput.setTooltip(thin.t('text_placeholder_of_base_format_description')); + baseFormatInputProperty.addEventListener(propEventType.CHANGE, function(e) { diff --git a/src/app/i18n.js b/src/app/i18n.js index bd973b97..1b5872a0 100644 --- a/src/app/i18n.js +++ b/src/app/i18n.js @@ -41,6 +41,20 @@ thin.i18n.currentLocaleId_; thin.i18n.translations_; +/** + * @type {Object} + * @private + */ +thin.i18n.defaultLocale_; + + +/** + * @type {Object} + * @private + */ +thin.i18n.defaultTranslations_; + + /** * @param {string} name * @param {Object=} opt_values @@ -49,7 +63,9 @@ thin.i18n.translations_; thin.i18n.translate = function(name, opt_values) { var i18n = thin.i18n; var msg = i18n.makeMessage_( - i18n.getMessages()[name], opt_values) || ''; + i18n.getMessages()[name] || + i18n.getDefaultMessages()[name], opt_values) || ''; + return goog.string.newLineToBr(goog.string.htmlEscape(msg)); }; @@ -91,6 +107,19 @@ thin.i18n.getMessages = function() { }; +/** + * @return {Object} + */ +thin.i18n.getDefaultMessages = function() { + var i18n = thin.i18n; + + if (!i18n.defaultTranslations_) { + i18n.defaultTranslations_ = /** @type {Object} */(i18n.defaultLocale_['messages']); + } + return i18n.defaultTranslations_; +}; + + /** * @return {string} */ @@ -133,6 +162,12 @@ thin.i18n.init = function() { i18n.currentLocaleId_ = localeId; i18n.currentLocale_ = locale; + + var defaultLocaleId = thin.callApp('getDefaultUILocale'); + i18n.defaultLocaleId_ = defaultLocaleId; + i18n.defaultLocale_ = goog.array.find(locales, function(loc) { + return loc.id == defaultLocaleId; + }); }; diff --git a/src/locales/en.js b/src/locales/en.js index b22ecda9..6a6b70ae 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -224,6 +224,7 @@ App.addLocale({ text_apply_locale_setting: 'After reloading the Editor, the setting will be applied.\nDo you want to apply now?', text_layout_force_edit_confirmation: 'Because this layout has been created with a newer version, there is a risk of some configurations are broken by editing.\nAre you sure you want to edit anyway?', text_placeholder_of_pageno_description: '[Available Placeholders] {page}:Page Number, {total}:Total Page Count', + text_placeholder_of_base_format_description: '[Available Placeholders] {value}:The formatted value', text_counted_page_target_description: '[Allowed Targets] List (The ID of target List) or Report (Empty)', text_feedback_in_project_site: 'Project Site', text_feedback_in_github: 'GitHub Issues', diff --git a/src/locales/ja.js b/src/locales/ja.js index fc1ae05e..438cddb9 100644 --- a/src/locales/ja.js +++ b/src/locales/ja.js @@ -222,6 +222,7 @@ App.addLocale({ text_apply_locale_setting: '設定を反映するにはエディタの再読み込みが必要です。\n今すぐ設定を反映しますか?', text_layout_force_edit_confirmation: 'このレイアウトは新しいバージョンのエディタで作成されているため、\n編集すると一部の設定情報が消失する可能性があります。\nそれでも開きますか?', text_placeholder_of_pageno_description: '[利用可能なプレースホルダ] {page}:ページ番号, {total}:総ページ数', + text_placeholder_of_base_format_description: '[利用可能なプレースホルダ] {value}:書式が反映された値', text_counted_page_target_description: '[指定可能な対象] リスト(対象リストID) or レポート(空)', text_feedback_in_project_site: 'プロジェクトサイトへ', text_feedback_in_github: 'GitHub Issues へ',