From 28c30a31809b22efbc4d49c2d8e8bda37fca43e4 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Fri, 10 Jun 2016 17:02:26 +0100 Subject: [PATCH] Make visualeditor-quick-access-characters.json always exist Bug: T137368 Change-Id: I3f0f88495323b74d156c24939ca12840b4b970c5 --- modules/ve-mw/i18n/en.json | 1 + modules/ve-mw/i18n/qqq.json | 1 + modules/ve-mw/init/ve.init.mw.Platform.js | 15 ++++++++------- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json index 32b847f18a..9cfd3f0ee9 100644 --- a/modules/ve-mw/i18n/en.json +++ b/modules/ve-mw/i18n/en.json @@ -287,6 +287,7 @@ "visualeditor-preference-tabs-prefer-ve": "Always give me the visual editor if possible", "visualeditor-preference-tabs-prefer-wt": "Always give me the source editor", "visualeditor-preference-tabs-remember-last": "Remember my last editor", + "visualeditor-quick-access-characters.json": "null", "visualeditor-recreate": "The page has been deleted since you started editing. Press \"$1\" to recreate it.", "visualeditor-redirect-description": "Redirect to $1", "visualeditor-savedialog-error-badtoken": "We could not save your edit because the session was no longer valid.", diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json index f38ac9b888..73e41046b0 100644 --- a/modules/ve-mw/i18n/qqq.json +++ b/modules/ve-mw/i18n/qqq.json @@ -298,6 +298,7 @@ "visualeditor-preference-tabs-prefer-ve": "Used in [[Special:Preferences]].\n\nUsed as label for a radio button to have VisualEditor be the preferred editor. Shown together with the following buttons, so consider formulating them consistently:\n* {{msg-mw|Visualeditor-preference-tabs-multi-tab}}\n* {{msg-mw|Visualeditor-preference-tabs-prefer-wt}}\n* {{msg-mw|Visualeditor-preference-tabs-remember-last}}", "visualeditor-preference-tabs-prefer-wt": "Used in [[Special:Preferences]].\n\nUsed as label for a radio button to have the wikitext editor be the preferred editor. Shown together with the following buttons, so consider formulating them consistently:\n* {{msg-mw|Visualeditor-preference-tabs-multi-tab}}\n* {{msg-mw|Visualeditor-preference-tabs-prefer-ve}}\n* {{msg-mw|Visualeditor-preference-tabs-remember-last}}", "visualeditor-preference-tabs-remember-last": "Used in [[Special:Preferences]].\n\nUsed as label for a radio button to have VisualEditor remember whether it was the last editor or not. Shown together with the following buttons, so consider formulating them consistently:\n* {{msg-mw|Visualeditor-preference-tabs-multi-tab}}\n* {{msg-mw|Visualeditor-preference-tabs-prefer-ve}}\n* {{msg-mw|Visualeditor-preference-tabs-prefer-wt}}", + "visualeditor-quick-access-characters.json": "JSON object mapping character labels to actual characters that can be inserted using the special character inserter.", "visualeditor-recreate": "Text shown when the editor fails to save the page due to it having been deleted since they opened VE. $1 is the message {{msg-mw|ooui-dialog-process-continue}}.", "visualeditor-redirect-description": "Title shown as the description of redirect nodes.\n\nParameters:\n* $1 - Target title of redirect", "visualeditor-savedialog-error-badtoken": "Error displayed in the save dialog if saving the edit failed due to an invalid edit token (likely due to the user having logged out in a separate window, or logged in again)", diff --git a/modules/ve-mw/init/ve.init.mw.Platform.js b/modules/ve-mw/init/ve.init.mw.Platform.js index d589ebfa8e..c293dd1d3d 100644 --- a/modules/ve-mw/init/ve.init.mw.Platform.js +++ b/modules/ve-mw/init/ve.init.mw.Platform.js @@ -186,15 +186,16 @@ ve.init.mw.Platform.prototype.fetchSpecialCharList = function () { var characters = {}, otherGroupName = mw.msg( 'visualeditor-special-characters-group-other' ), otherMsg = mw.msg( 'visualeditor-quick-access-characters.json' ), - groupObject; + other, groupObject; - if ( otherMsg !== '' ) { - try { - characters[ otherGroupName ] = JSON.parse( otherMsg ); - } catch ( err ) { - ve.log( 've.init.mw.Platform: Could not parse the Special Character list.' ); - ve.log( err ); + try { + other = JSON.parse( otherMsg ); + if ( other ) { + characters[ otherGroupName ] = other; } + } catch ( err ) { + ve.log( 've.init.mw.Platform: Could not parse the Special Character list.' ); + ve.log( err ); } $.each( mw.language.specialCharacters, function ( groupName, groupCharacters ) {