User:Ochaochaocha3/MODIFY THE MAIN MENU (MobileFrontend)/ja

Topic:Tiggc18fvd3stmsfより、拡張機能MobileFrontendのメインメニューの変更手順。

メインメニューの変更手順 edit

includes/skins/SkinMinerva.php の編集 edit

メニューを個人的に変更したい場合、includes/skins/SkinMinerva.php を編集する。

以下を探す。

protected function getDiscoveryTools()

以下の行を探す。

// Nearby link (if supported)

この行の上に以下を追加する。

$menu->insert( 'Upload' )
	->addComponent(
		$this->msg( 'mobile-frontend-upload-button' )->escaped(),
		SpecialPage::getTitleFor( 'Upload',
			MWNamespace::getCanonicalName( $config->get( 'MFContentNamespace' ) ) )->getLocalUrl() .
				'#/test',
		MobileUI::iconClass( 'mf-upload-invert', 'before' ),
		[
			'id' => 'uploadButton',
			'data-event-name' => 'upload',
		]
	);

$menu->insert( 'ListImages' )
	->addComponent(
		$this->msg( 'mobile-frontend-listimages-button' )->escaped(),
		SpecialPage::getTitleFor( 'ListFiles',
			MWNamespace::getCanonicalName( $config->get( 'MFContentNamespace' ) ) )->getLocalUrl() .
				'#/test',
		MobileUI::iconClass( 'mf-listimages-invert', 'before' ),
		[
			'id' => 'listimagesButton',
			'data-event-name' => 'ListImages',
		]
	);

翻訳ファイルの編集 edit

i18n/en.json を編集する[1]

以下の行を探す。

"mobile-frontend-random-button": "Random",

以下を追加する。

"mobile-frontend-upload-button": "Upload",
"mobile-frontend-listimages-button": "List Images",

extension.json の編集 edit

extension.json を編集する。

以下の行を探す。

"mobile.mainMenu.icons": {

以下のセクションを探す。

"images": {
	"anonymous": "resources/mobile.mainMenu.icons/anonymous.svg",

この行の下に以下を追加する。

"upload": "resources/mobile.mainMenu.icons/upload.svg",
"listimages": "resources/mobile.mainMenu.icons/listimages.svg",

アイコンの追加 edit

フォルダ resources/mobile.mainMenu.icons に行く。

必要な2つの新しいSVGファイル(希望するアイコン)を resources/mobile.mainMenu.icons に追加する。

  • upload.svg
  • listimages.svg

テスト edit

この修正は twh4u.ddns.net でテストした。

脚注 edit

  1. 日本語の場合 i18n/ja.json を編集すればよいのだろう。