Template:Script doc autoNote: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button. Firefox: hold down the Shift key while clicking Reload (or press Ctrl-Shift-R). Google Chrome and Safari users can just click the Reload button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// https://en.wikipedia.beta.wmflabs.org/w/index.php?title=User:Zuex2017/dial.js&action=raw&ctype=text/javascript
// https://www.mediawiki.org/wiki/ResourceLoader/Core_modules
// https://en.wikipedia.org/wiki/Wikipedia:User_scripts/Techniques
// https://www.mediawiki.org/wiki/Manual:Ajax
// https://www.mediawiki.org/wiki/Manual:Interface/JavaScript

let i18nStrings = {};

i18nStrings['en'] = {
	portletSettings: 'dial settings',
	portletSettingsTooltip: 'tooltip text goes here',

	foo: 'aaaaa',
	save: 'save',
	cancel: 'cancel',
}

i18nStrings['zh-Hant'] = {
	portletSettings: '設定方言顯示',
	portletSettingsTooltip: '待筆',

	foo: '之',
	save: '記',
	cancel: '止',
}

i18nStrings['zh'] = i18nStrings['zh-Hant']

let lang = mw.config.get('wgUserLanguage');
let i18n = i18nStrings[lang] || i18nStrings['en'];

function analyseEntry() {
	// x
}

function createSettingsWindow() {
	function SettingsDialog( config ) {
		SettingsDialog.super.call( this, config );
	}
	OO.inheritClass( SettingsDialog, OO.ui.ProcessDialog );

	SettingsDialog.static.name = 'settingsDialog';
	SettingsDialog.static.title = i18n.foo;
	SettingsDialog.static.actions = [
		{action: 'save', label: i18n.save, flags: ['primary', 'constructive']},
		{action: 'cancel', label: i18n.cancel, flags: 'safe'},
	];
}

function conjureSettingsWindow() {
	mw.notify(i18n.foo);
}

$(function() {
	let zhLinks = [];
	let zhLinksUnavailable = [];

	$('[lang=zh] > a').each(function(index) {
		console.log($(this));

		let entry = $(this).attr('title');
		let doesNotExist = $(this).hasClass('new')

		if (doesNotExist) {
			zhLinksUnavailable.push(entry);
		} else {
			zhLinks.push(entry);
		}
	});
	console.log('non');
	console.log(zhLinksUnavailable);
	console.log('ok');
	console.log(zhLinks);

	$.getJSON(
		mw.util.wikiScript('api'),
		{
			action: 'raw',
			title: 'User:Zuex2017/sandbox/英國'
		},
		function(data) {
			console.log(data);
		}
	);

});

if (mw.config.values.wgAction == 'view') {
	var portletLink = mw.util.addPortletLink(
		'p-tb',
		'#',
		i18n.portletSettings,
		't-dialsettings',
		i18n.portletSettingsTooltip
	);
	$(portletLink).click(function(event) {
		conjureSettingsWindow();

		event.preventDefault(); // do not jump to top
	});
}