Merge "Prevent JS code from changing 'skin-view-edit-local' message to 'skin-view-edit'"

This commit is contained in:
jenkins-bot 2023-07-17 23:54:53 +00:00 committed by Gerrit Code Review
commit b9f0764711
2 changed files with 8 additions and 8 deletions

View file

@ -34,7 +34,7 @@ class VisualEditorDesktopArticleTargetInitModule extends FileModule {
// Check the localisation cache for which skins have a custom message for this.
// We only need this for the current skin, but ResourceLoader's message cache
// does not fragment by skin.
foreach ( [ 'edit', 'create' ] as $msgKey ) {
foreach ( [ 'edit', 'create', 'edit-local', 'create-local' ] as $msgKey ) {
// MediaWiki defaults
$messages[] = "skin-view-$msgKey";
foreach ( $services->getSkinFactory()->getSkinNames() as $skname => $unused ) {

View file

@ -327,7 +327,7 @@
function getTabMessage( key ) {
var tabMsgKey = tabMessages[ key ];
if ( !tabMsgKey && ( key === 'edit' || key === 'create' ) ) {
if ( !tabMsgKey && ( key === 'edit' || key === 'create' || key === 'edit-local' || key === 'create-local' ) ) {
// Some skins don't use the default 'edit' and 'create' message keys.
// e.g. vector-view-edit, vector-view-create
tabMsgKey = mw.config.get( 'skin' ) + '-view-' + key;
@ -919,15 +919,15 @@
if ( $( '#ca-view-foreign' ).length ) {
if ( tabMessages[ action + 'localdescriptionsource' ] ) {
// The following messages can be used here:
// * editlocaldescriptionsource
// * createlocaldescriptionsource
// * visualeditor-ca-editlocaldescriptionsource
// * visualeditor-ca-createlocaldescriptionsource
$caEditLink.text( mw.msg( tabMessages[ action + 'localdescriptionsource' ] ) );
}
} else {
if ( tabMessages[ action + 'source' ] ) {
// The following messages can be used here:
// * editsource
// * createsource
// * visualeditor-ca-editsource
// * visualeditor-ca-createsource
$caEditLink.text( mw.msg( tabMessages[ action + 'source' ] ) );
}
}
@ -944,7 +944,7 @@
// 2) when onEditTabClick is not bound (!pageCanLoadEditor) it will
// just work.
veEditUrl,
getTabMessage( action ),
getTabMessage( action + ( $( '#ca-view-foreign' ).length ? '-local' : '' ) ),
'ca-ve-edit',
mw.msg( 'tooltip-ca-ve-edit' ),
mw.msg( 'accesskey-ca-ve-edit' ),
@ -967,7 +967,7 @@
$caEdit.after( $caVeEdit );
}
}
$caVeEditLink.text( getTabMessage( action ) );
$caVeEditLink.text( getTabMessage( action + ( $( '#ca-view-foreign' ).length ? '-local' : '' ) ) );
}
// If the edit tab is hidden, remove it.