MediaWiki:Common.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(@requires: MediaWiki:Mw-customcollapsible.js) |
(+CollapseBox_captionCollapse & Co (https://offene-naturfuehrer.de/w/index.php?title=MediaWiki:Common.js&oldid=69203)) |
||
Zeile 19: | Zeile 19: | ||
* @type object | * @type object | ||
*/ | */ | ||
− | $.jI18n = {}; | + | $.jI18n = { |
− | + | de: { | |
+ | CollapseBox_captionCollapse : ' (weniger anzeigen) ', | ||
+ | CollapseBox_captionExpand : ' (mehr...) ', | ||
+ | CollapseBox_toolTipCollapse : '(klicken um Zusatzinformationen zu verbergen)', | ||
+ | CollapseBox_toolTipExpand : '(klicken um Zusatzinformationen anzuzeigen)' | ||
+ | }, | ||
+ | en: { | ||
+ | CollapseBox_captionCollapse : ' (show less) ', | ||
+ | CollapseBox_captionExpand : ' (more...) ', | ||
+ | CollapseBox_toolTipCollapse : '(click to hide information below)', | ||
+ | CollapseBox_toolTipExpand : '(click to show more information below)' | ||
+ | } | ||
+ | } | ||
/** | /** | ||
* @description Get resource string (e.g. text messages, image URLs) for a given language, based on a string-key | * @description Get resource string (e.g. text messages, image URLs) for a given language, based on a string-key |
Version vom 4. Juni 2018, 12:38 Uhr
/* Das folgende JavaScript wird für alle Benutzer geladen. */
/*
* @requires: MediaWiki:Mw-customcollapsible.js
*/
/**
* global resource string dictionary
*
* $.jI18n[iso-language-cod][resourceKey], e.g.
* $.jI18n = {
* en: { CollapseBox_captionCollapse : '(show less)' },
* de: { CollapseBox_captionCollapse : '(weniger anzeigen)' }
* };
*
* Nomenclature proposal: if an extra plugin is used, strings can be designated by prefixing them:
* “plugin_toolTipSomthing” otherwise just “toolTipSomthing” (global string). So it’s more clear if
* a string is intended to be global or plugin specific.
* @augments $
* @type object
*/
$.jI18n = {
de: {
CollapseBox_captionCollapse : ' (weniger anzeigen) ',
CollapseBox_captionExpand : ' (mehr...) ',
CollapseBox_toolTipCollapse : '(klicken um Zusatzinformationen zu verbergen)',
CollapseBox_toolTipExpand : '(klicken um Zusatzinformationen anzuzeigen)'
},
en: {
CollapseBox_captionCollapse : ' (show less) ',
CollapseBox_captionExpand : ' (more...) ',
CollapseBox_toolTipCollapse : '(click to hide information below)',
CollapseBox_toolTipExpand : '(click to show more information below)'
}
}
/**
* @description Get resource string (e.g. text messages, image URLs) for a given language, based on a string-key
* If no resource is defined in a given language for a resource key, the resource for 'en' will be returned,
* if this is missing as well an error message is returned “MISSING RESOURCE: ...”.
* @augments $
* @requires mw.config for getting global variables
* @requires $.jI18n global language resource keys and their translated strings
* @param {string} resourceKey key for the resource
* @returns {String}
*/
$.resource = function (resourceKey) {
var lang = mw.config.get('wgUserLanguage').split('-')[0]; // language: 'pt-BR', 'de-formal', etc.
return ($.jI18n[lang] && $.jI18n[lang][resourceKey] ?
$.jI18n[lang][resourceKey] :
($.jI18n.en[resourceKey]) ? $.jI18n.en[resourceKey] : 'MISSING RESOURCE: no $.jI18n.en.' + resourceKey + ' defined.');
};
// click-text modifications for mw-customcollapsible triggering from outside of mw-collapsible
mw.loader.load( mw.config.get('wgScriptPath') + '/index.php?title=MediaWiki:Mw-customcollapsible.js&action=raw&ctype=text/javascript' );
///////////////////////
// Load scripts page specific:
switch (mw.config.get( 'wgPageName' )) { // Minimize the pages on which the code will be loaded
case 'Hilfe:Gemeinfreie_Patente_(Public_Domain)':
case 'Benutzer:Andreas_Plank/Hilfe_–_Gemeinfreie_Patente_(Public_Domain)':
mw.loader.load( mw.config.get('wgScriptPath') + '/index.php?title=MediaWiki:SearchTools.js&action=raw&ctype=text/javascript' );
break;
};
///////////////////////