https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AFlags%2Fsandbox Module:Flags/sandbox - Revision history 2025-05-25T17:31:54Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.2 https://en.wikipedia.org/w/index.php?title=Module:Flags/sandbox&diff=949282913&oldid=prev Pppery: Pppery moved page Module:Flags/Sandbox to Module:Flags/sandbox without leaving a redirect 2020-04-05T16:16:46Z <p>Pppery moved page <a href="/w/index.php?title=Module:Flags/Sandbox&amp;action=edit&amp;redlink=1" class="new" title="Module:Flags/Sandbox (page does not exist)">Module:Flags/Sandbox</a> to <a href="/wiki/Module:Flags/sandbox" title="Module:Flags/sandbox">Module:Flags/sandbox</a> without leaving a redirect</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <tr class="diff-title" lang="en"> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 16:16, 5 April 2020</td> </tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div> </td></tr></table> Pppery https://en.wikipedia.org/w/index.php?title=Module:Flags/sandbox&diff=565462682&oldid=prev QuimGil: Fix in translation variable 2013-07-23T11:23:33Z <p>Fix in translation variable</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:23, 23 July 2013</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 11:</td> <td colspan="2" class="diff-lineno">Line 11:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> for translation, commonsName in pairs(translations.fullName) do</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> for translation, commonsName in pairs(translations.fullName) do</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if commonsName == name then</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if commonsName == name then</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> link = <del style="font-weight: bold; text-decoration: none;">tranlastion</del></div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> link = <ins style="font-weight: bold; text-decoration: none;">translation</ins></div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> break --if found break out from the loop</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> break --if found break out from the loop</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> </tr> </table> QuimGil https://en.wikipedia.org/w/index.php?title=Module:Flags/sandbox&diff=565366038&oldid=prev Moroboshi: test upload 2013-07-22T18:45:07Z <p>test upload</p> <p><b>New page</b></p><div>local p = {}<br /> <br /> -- Loading the flag translations module --<br /> local translations = mw.loadData(&quot;Module:Flags/LocaleData&quot;)<br /> local master = mw.loadData(&quot;Module:Flags/MasterData&quot;)<br /> <br /> -- check if name is an original name in translation.fullname and<br /> -- return its value, otherwise return nil<br /> function check_translation(name)<br /> local link<br /> for translation, commonsName in pairs(translations.fullName) do<br /> if commonsName == name then<br /> link = tranlastion<br /> break --if found break out from the loop<br /> end<br /> end<br /> return link<br /> end<br /> <br /> -- Size of flag --<br /> -- Function to define the default size for the flag if needed<br /> function defaultSize()<br /> --todo: move exception to Module:Flags/MasterData<br /> local sizeExceptions = { &quot;Nepal&quot;, &quot;Switzerland&quot;, &quot;the Vatican City&quot;, }<br /> local size = &quot;20x22px&quot; --initialize with default value<br /> for some,exceptions in pairs(sizeExceptions) do<br /> if commonsName == exceptions then<br /> size = &quot;20x17px&quot;<br /> break --if found break out from loop<br /> end<br /> end<br /> return size<br /> end<br /> <br /> -- Assigning the parameter to a flag and a link<br /> function p.flag(territory)<br /> --always declare local variable, they are more efficient and dont pollute global namespace<br /> local commonsName<br /> local flagOf = &quot;Flag_of_&quot; -- Converts &quot;Flag of&quot; in a variable in order to accept images that don&#039;t follow this name schema<br /> local link = &quot;&quot;<br /> -- more efficient to access<br /> local flag_code = territory.args[1] or &quot;&quot;<br /> -- Searching in the master table only.<br /> -- 2 letter code search<br /> if #flag_code == 2 then<br /> -- try to assign a value to commonsName and check for nil value<br /> commonsName = master.twoLetter[flag_code]<br /> --if check_translation return nil then it will execute the or part and assign commonsName to link<br /> if commonsName then link = check_translation(commonsName) or commonsName; end<br /> elseif #flag_code == 3 then -- 3 letter code search<br /> commonsName = master.threeLetter[flag_code]<br /> if commonsName then link = check_translation(commonsName) or commonsName; end<br /> end<br /> -- check if commonsName is still nil<br /> if commonsName == nil then<br /> -- check master.fullName table<br /> commonsName = master.fullName[flag_code]<br /> if commonsName then<br /> link = check_translation(commonsName) or commonsName;<br /> else -- Searching in FlagTranslations<br /> commonsName = translations.fullName[flag_code]<br /> if commonsName then<br /> link = flag_code<br /> else -- Fallback to Commons when the parameter doesn&#039;t have an entry in the tables<br /> commonsName = flag_code<br /> link = flag_code<br /> end<br /> end<br /> end<br /> <br /> -- Variant check for historical flags --<br /> local variant = territory.args[3]<br /> if variant and variant ~= &quot;&quot; then<br /> commonsName = master.variant[commonsName .. &quot;|&quot; .. variant]<br /> flagOf=&quot;&quot;<br /> end<br /> <br /> -- Label check --<br /> variant = territory.args[2]<br /> if variant and variant ~=&quot;{{{2}}}&quot; then<br /> commonsName = master.variant[commonsName .. &quot;|&quot; .. variant]<br /> flagOf=&quot;&quot;<br /> end<br /> <br /> -- Digesting Commons flag files not following the format &quot;Flag of &quot;<br /> -- These filenamess must be preceded by &quot;File:&quot; in the table values.<br /> <br /> if commonsName ~= nil and string.find( commonsName, &quot;File:&quot;, 1 ) == 1 then<br /> commonsName = string.sub( commonsName, 6)<br /> flagOf=&quot;&quot;<br /> end<br /> <br /> -- Fallback for non-identified variant/label flags --<br /> if commonsName == nil then commonsName = &quot;Flag of None&quot; end<br /> <br /> -- Border for everybody except Nepal and Ohio<br /> -- todo: move exception to Module:Flags/MasterData<br /> local border = &quot;border|&quot;<br /> if commonsName == &quot;Nepal&quot; or commonsName == &quot;Ohio&quot; then<br /> border = &quot;&quot;<br /> end<br /> <br /> -- Checking whether a size parameter has been introduced, otherwise set default<br /> if territory.args[4]:find(&quot;px&quot;, -2) ~= nil then<br /> size = territory.args[4]<br /> else<br /> size = defaultSize(commonsName)<br /> end<br /> <br /> -- Customizing the link<br /> openBrackets = &quot;[[&quot;<br /> closeBrackets = &quot;]]&quot;<br /> if territory.args[5] == &quot;&quot; then<br /> flagLink = &quot;&quot;<br /> textLink = &quot;&quot;<br /> openBrackets = &quot;&quot;<br /> closeBrackets = &quot;&quot;<br /> elseif territory.args[5] ~= &quot;{{{link}}}&quot; then<br /> flagLink = territory.args[5]<br /> textLink = territory.args[5] .. &quot;|&quot;<br /> else flagLink = link<br /> textLink = link .. &quot;|&quot;<br /> end<br /> <br /> -- Text in addition to flag<br /> if territory.args[6] == &quot;&quot; then<br /> text = &quot; &quot; .. openBrackets .. link .. closeBrackets<br /> elseif territory.args[6] ~= &quot;{{{text}}}&quot; then<br /> text = &quot; &quot; .. openBrackets .. textLink .. territory.args[6] .. closeBrackets<br /> else text = &quot;&quot;<br /> end<br /> <br /> return &#039;[[File:&#039; .. flagOf .. commonsName .. &#039;.svg|&#039; .. border .. &#039;link=&#039; .. flagLink .. &#039;|&#039;.. size .. &#039;]]&#039; .. text<br /> end<br /> return p</div> Moroboshi