10,594
edits
No edit summary Tag: Reverted |
No edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!) | -- INTRO: (!!! DO NOT RENAME THIS PAGE !!!) | ||
-- This module allows any template or module to be copy/pasted between | -- This module allows any template or module to be copy/pasted between | ||
Line 153: | Line 152: | ||
if not dataset then | if not dataset then | ||
error(formatMessage(i18nDataset, 'error_no_dataset', {})) | error(formatMessage(i18nDataset, 'error_no_dataset', {})) | ||
end | |||
-- Give helpful error to thirdparties who try and copy this module. | |||
if not mw.ext or not mw.ext.data or not mw.ext.data.get then | |||
error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset) | |||
end | |||
local data = mw.ext.data.get(dataset, lang) | |||
if data == false then | |||
if dataset == i18nDataset then | |||
-- Prevent cyclical calls | |||
error('Missing Commons dataset ' .. i18nDataset) | |||
else | |||
error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)})) | |||
end | |||
end | end | ||
return data | return data |