模組討論:Lang
外观
Tigerzeng在话题“編輯請求 2021-02-12”中的最新留言:4年前
編輯請求 2019-08-13
请求已处理--Xiplus#Talk 2019年8月16日 (五) 11:38 (UTC)
Category:含有明確引用中文的條目而不是Category:含有中文的條目,而英语德语之类的不需要做特殊处理,所以这些部分可以删掉。现在最需要添加的是韩语的特殊处理,因为刚刚Template:Lang-ko改成了使用本模块,而中文维基是建立的是Category:含有朝鮮語的條目,而不是Category:含有韓語的條目,导致现在属于Category:含有朝鮮語的條目的页面数量正在一点一点地往下降,所以这部分要赶紧修改。我在沙盒里修改了这个函数,做更新的时候只需要覆盖make_category函数即可。--Vozhuowhisper 2019年8月13日 (二) 15:05 (UTC)
模块里有个make_category的函数,这里面的的意思是特殊的code需要做特殊的分类处理,比如中文会加入- Category:含有朝鮮語的條目。--Xiplus#Talk 2019年8月15日 (四) 13:49 (UTC)
- CJ集团”条目用了lang-ko模板,但其页面属性没有Category:含有朝鮮語的條目,反而却有了Category:含有非中文內容的條目。光看Category:含有非中文內容的條目第一页就有大量韩国相关的条目,这些明显都是被错分类的。--Vozhuowhisper 2019年8月16日 (五) 11:31 (UTC) 我当时看的时候分类有14000+页面,每刷新一次页面数就掉一次,现在页面有13000+,估计已经掉光了。可以看一个例子,“
我沒看到問題,頁面仍然在
請修正lang_xx_inherit
请求已拒绝
當使用lang-xx模板時候,如果script=Yyyy被指定,此時的轉寫會被渲染成xx-Yyyy-Latn模式,導致渲染失敗。請將其修正為xx-Latn模式,確保Yyyy不會影響Latn的渲染,謝謝!--173.68.165.114(留言) 2020年8月27日 (四) 16:35 (UTC)
- 需要更改make_translit (code, language_name, translit, std, tscript, style)。--173.68.165.114(留言) 2020年8月27日 (四) 17:21 (UTC)
- 請在沙盒提供新版本。--Xiplus#Talk 2020年9月30日 (三) 08:26 (UTC)
編輯請求 2021-02-12
![]() | 正在請求他人代為編輯受保護的頁面(連鎖保護 编辑:仅允许管理员 移动:仅允许管理员) 注意:本模板不是用於請求開放頁面給予編輯,相關請求請至请求解除保护頁申請;本模板是用於請求可以編輯的用户幫忙修改內容。 請求時請列明理由及內容,確保修改有共識基礎及沒有爭議,否則請先在受保護頁面的討論頁進行討論。(工具:處理、申請解除保護) 如果您想直接展示给管理员修改后的页面及清楚地列出编辑差异,请将本模板改为 {{Editprotected|patch=}} ,点击「显示预览」并按照提示进一步操作。 |
在模块中添加:
--[[--------------------------< _ N A M E _ F R O M _ T A G >-------------------------------------------------- Returns language name associated with IETF language tag if valid; error message else. All code combinations supported by {{lang}} and the {{lang-xx}} templates are supported by this function. Set invoke's |link= parameter to yes to get wikilinked version of the language name. Module entry point from another module ]] local function _name_from_tag (args) local subtags = {}; -- IETF subtags script, region, variant, and private local raw_code = args[1]; -- save a copy of the input IETF subtag local link = 'yes' == args['link']; -- make a boolean local label = args.label; local code; -- the language code local msg; -- gets an error message if IETF language tag is malformed or invalid local language_name = ''; code, subtags.script, subtags.region, subtags.variant, subtags.private, msg = get_ietf_parts (raw_code); if msg then local template = (args['template'] and table.concat ({'{{', args['template'], '}}: '})) or ''; -- make template name (if provided by the template) return table.concat ({'<span style=\"font-size: 100%; font-style: normal;\" class=\"error\">Error: ', template, msg, '</span>'}); end raw_code = format_ietf_tag (code, subtags.script, subtags.region, subtags.variant, subtags.private); -- format to recommended subtag styles; private omitted because private language_name = language_name_get (raw_code, code); -- get language name; try ietf tag first, then code w/o variant then code w/ variant language_name = language_name:gsub ('%s+%b()', ''); -- remove IANA parenthetical disambiguators or qualifiers from names that have them if link then -- when |link=yes, wikilink the language name if language_name:find ('languages') then language_name = make_wikilink (language_name, label); -- collective language name uses simple wikilink elseif lang_data.article_name[code] then language_name = make_wikilink (lang_data.article_name[code][1], label or language_name); -- language name with wikilink from override data else language_name = make_wikilink (language_name .. ' language', label or language_name); -- language name with wikilink end end return language_name; end --[[--------------------------< N A M E _ F R O M _ T A G >---------------------------------------------------- Module entry point from an {{#invoke:}} ]] local function name_from_tag (frame) -- entry point from an {{#invoke:Lang|name_from_tag|<ietf tag>|link=<yes>|template=<template name>}} return _name_from_tag (getArgs(frame)) -- pass-on the args table, nothing else; getArgs() so we also get parent frame end --[[--------------------------< _ T A G _ F R O M _ N A M E >-------------------------------------------------- Returns the ietf language tag associated with the language name. Spelling of language name must be correct according to the spelling in the source tables. When a standard language name has a parenthetical disambiguator, that disambiguator must be omitted (they are not present in the data name-to-tag tables). Module entry point from another module ]] local function _tag_from_name (args) -- entry point from another module local msg; if args[1] and '' ~= args[1] then local data = mw.loadData ('Module:Lang/tag from name'); -- get the reversed data tables TODO: change when going live local lang = args[1]:lower(); -- allow any-case for the language name (speeling must till be correct) local tag = data.rev_override_table[lang] or data.rev_lang_table[lang] or data.rev_lang_dep_table[lang]; -- get the code; look first in the override then in the standard if tag then return tag, true; -- language name found so return tag and done; second return used by is_lang_name() else msg = 'language: ' .. args[1] .. ' not found' -- language name not found, error message end else msg = 'missing language name' -- language name not provided, error message end local template = ''; if args.template and '' ~= args.template then template = table.concat ({'{{', args['template'], '}}: '}); -- make template name (if provided by the template) end return table.concat ({'<span style=\"font-size: 100%; font-style: normal;\" class=\"error\">Error: ', template, msg, '</span>'}); end --[[--------------------------< T A G _ F R O M _ N A M E >---------------------------------------------------- Module entry point from an {{#invoke:}} ]] local function tag_from_name (frame) -- entry point from an {{#invoke:Lang|tag_from_name|<language name>|link=<yes>|template=<template name>}} local result, _ = _tag_from_name (getArgs(frame)) -- pass-on the args table, nothing else; getArgs() so we also get parent frame; supress second return used by is_lang_name() return result; end
见Special:PermanentLink/64248037#In lang模块。由于本人不太了解技术细节,因此只是从英维对应模块处拷贝了以上代码。有可能无法正常工作。----Yining Chen(留言|签名) 2021年2月12日 (五) 08:57 (UTC)
- 還要配合Module_talk:Lang/data#編輯請求_2021-02-12-- Sunny00217 2021年2月12日 (五) 12:04 (UTC)
- 我已在沙盒中合并英文维基的最新版本,但需要测试。--Vozhuowhisper 2021年2月12日 (五) 14:44 (UTC)
- 目前还需要更新Module:TableTools,请看到的管理员先更新TableTools模块。--Vozhuowhisper 2021年2月18日 (四) 06:04 (UTC)
- Module:TableTools已更新,请在Module_talk:Lang/testcases检查变更后的格式变化。--Vozhuowhisper 2021年2月24日 (三) 08:23 (UTC)
- 检查完毕,要是没有其他人提出意见的话我会认为当前沙盒版本中的内容可以正常运作。管理员需要同时更新Module:Lang、Module:Lang/data和Module:Language/data/iana_languages,替换为各自沙盒中的内容(沙盒修改日期为3月3日,以防之后有其他人更新)。另外更新之后不建议全保护Module:Lang/data,因为这里面的中文还没写完,经常要添加新的语言,全保护的话修改请求经常无法得到及时反馈,建议降为模板保护。--Vozhuowhisper 2021年3月3日 (三) 10:47 (UTC)
- 我在查看Module_talk:Lang/testcases页面的时候发现页面上显示了大量错误,这个是代码设计成这样的吗?--Yining Chen(留言|签名) 2021年3月4日 (四) 11:23 (UTC)
- 现在的沙盒中的版本是待更新的版本,不能用来检查测试样例,要检查测试样例需要修改Module:Lang/sandbox的第13行(改为加载Module:Lang/data/sandbox)和Module:Lang/data/sandbox的51和52行(改为加载Module:Language/data/iana languages/sandbox)。--Vozhuowhisper 2021年3月4日 (四) 14:30 (UTC)
- Module:TableTools已更新,请在Module_talk:Lang/testcases检查变更后的格式变化。--Vozhuowhisper 2021年2月24日 (三) 08:23 (UTC)
- 目前还需要更新Module:TableTools,请看到的管理员先更新TableTools模块。--Vozhuowhisper 2021年2月18日 (四) 06:04 (UTC)
- 改动稍大,稳妥起见等待至3月10日执行修改。--Tiger(留言) 2021年3月7日 (日) 07:50 (UTC)
- 我已在沙盒中合并英文维基的最新版本,但需要测试。--Vozhuowhisper 2021年2月12日 (五) 14:44 (UTC)