Module:WikidataIB and Module:WikidataIB/sandbox: Difference between pages
(Difference between pages)
imported>Pigsonthewing Undid revision 1326353202 by Pigsonthewing (talk) per talk |
imported>Lucas Werkmeister fix if-found-then-break placement (should hopefully fix the error mentioned at Module talk:WikidataIB#Edit request 14 November 2025 |
||
| Line 1,114: | Line 1,114: | ||
local unitsymbols = mw.wikibase.getBestStatements(unitqid, "P5061") | local unitsymbols = mw.wikibase.getBestStatements(unitqid, "P5061") | ||
-- construct fallback table, add local lang and multiple languages | -- construct fallback table, add local lang and multiple languages | ||
local fbtbl = mw.language.getFallbacksFor( args.lang ) | local fbtbl = mw.language.getFallbacksFor( args.lang, mw.language.FALLBACK_STRICT ) | ||
table.insert( fbtbl, 1, args.lang ) | table.insert( fbtbl, 1, args.lang ) | ||
table.insert( fbtbl, | table.insert( fbtbl, "mul" ) | ||
table.insert( fbtbl, "en" ) | |||
local found = false | local found = false | ||
for idx1, us in ipairs(unitsymbols) do | for idx1, us in ipairs(unitsymbols) do | ||
| Line 1,125: | Line 1,126: | ||
break | break | ||
end | end | ||
end -- loop through fallback table | |||
if found then break end | if found then break end | ||
end -- loop through values of P5061 | end -- loop through values of P5061 | ||
if found then usep, unit = " ", usym end | if found then usep, unit = " ", usym end | ||