Jump to content

Module talk:Lang-zh/Archive 2

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Lowercase sigmabot III (talk | contribs) at 01:35, 8 October 2014 (Archiving 1 discussion(s) from Module talk:Zh) (bot). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Archive 1Archive 2Archive 3Archive 4Archive 5

Zh-xx consolidation dicussion (copy)

The more I look, the more I feel the mess at Category:Chinese multilingual support templates is out of control. There seems to be a lot of redundancy with all these templates...redundancy in of itself isn't bad, but it causes problems when one template is updated (like I recently did), since there are like a hundred others that need to be updated as well, and it can't necessarily be done with AWB.

So, to that end, I just created User:Rjanag/zh, a template that I believe has the functionality of all of these templates. The only difference is that you have to use named parameters, not numbered...but I think most of these template calls used named parameters anyway (ie, {{zh-cp|c=某|p=something}}, rather than {{zh-cp|某|something}}). When making it, I was careful to make sure that I didn't lose any of the functionalities contained in any of the other templates. Ideally, this template could be moved to {{zh}} and then all articles could just use that one, and display the relevant Chinese and romanizations based on what templates are used (for example, some would use {{zh|c=something|p=something|l=something}}, while others might use {{zh|s=something|t=something|p=something}}, the difference being that the second one gives both simplified and traditional). Currently, though, {{zh}} is a redirect to {{zh icon}} and a lot of pages seem to use it; it might be used in other ways, too, because its WhatLinksHere says it's included in some random pages (for instance, Quiznos) but I can't find it in the wikitext, suggesting that it's a transclusion within a transclusion....

Anyway, I'm thinking that if it's possible some day for me to go through and manually replace the {{zh}}s with {{zh icon}}s, then I can move this new template to there and slowly start replacing specific templates (like {{zh-cp}}) with this one, in all the articles where they're used. Do you have any thoughts on this? rʨanaɢ talk/contribs 06:35, 18 September 2009 (UTC)

Good idea, a lot of work. You might want to put your template in mainspace under "zh-testing" or s.t., redirect a common zh-xx template to it, and wait for the complaints to flood in if you've missed s.t., then try another, etc., until you're confident you've got it right, meanwhile migrating from zh to zh icon with AWB (preparse?). Of course, it might not be possible to rd some of the zh-xx templates until the individual articles have named parameters; that could be done with AWB and regex, though I don't know if I'm up to that kind of complexity in regex--I can't get some things to work that look simple on paper. Anyway, no point in editing the individual articles (except for named parameters) until you've redirected all the templates and they're working well. I wouldn't spend my time on it even then; there are bots that can automate the task. kwami (talk) 07:43, 18 September 2009 (UTC)
Impressive, having a template where Cantonese is nor forced to Jyutping would be really good! Akerbeltz (talk) 22:47, 18 September 2009 (UTC)
One comment: first=t puts Tongyong before Hanyu, but since Taiwan's switched to Hanyu, do we want them linked like that? Would it be possible to have a generic n=x, where n is any ordinal, and x is any parameter, and repeatable (1=t, 2=s, 3=p, etc.)? kwami (talk) 06:35, 19 September 2009 (UTC)
Ah, I didn't think about that. I could just get rid of the Tongyong-before-Hanyu bit...the important thing is allowing trad. to go before simp., but I'm not so concerned about the different Pinyin styles. I also considered adding something like first=j to allow Jyutping to go before Pinyin (for Cantonese-related articles), but then again I'm not sure how widely accepted/used Jyutping is as compared to others.
As for an n=x setup, it should be possible, it would just require lots of messy code—as you can see with the trad./simp. characters, the only way I really know to do it so far is to repeat the code over and over again in different parts of the template. Another option would be to divide the templates into core and shell templates...ie, put all the messy code for displaying simplified characters (for example) into {{zh-s}} (after usurping that...or I could just give it a new name), do that for everything, and then make {{zh}} itself be nothing more than a shell template that has a big #switch statement deciding which thing to show and when. It sounds like something I can play around with in my userspace for a while...these things always seem to work out better in my head than they do in actual code!
If enough functionality gets added to that, it might even be better to divide this across two templates, the current {{zh}} template left more or less as-is to be used in most cases (where people aren't concerned about ordering and the current version is sufficient), and something new, like {{zh-full}} or something, which would have extended functionality but also more parameters and more complicated syntax. rʨanaɢ talk/contribs 15:12, 19 September 2009 (UTC)

The people behind Jyutping are just pushy (off Wiki I mean); it has flaws, especially for an English speaking audience, especially the j for [j] and c for [tʃ] thing. Is it not possible to have the ordering flexible, as in, that if you move one above the other manually, they display that way? I must confess to a high degree of ignorance regarding templates. Akerbeltz (talk) 18:02, 19 September 2009 (UTC)

I don't foresee too much need for flexibility apart from traditional before simplified. Actually, I'd think we'd want that as the default, with "first=s" as an option. After all, traditional is the international form, with simplified being restricted to mainland China (and maybe Singapore?). kwami (talk) 19:41, 19 September 2009 (UTC)
Perhaps...although at this point it will be difficult to change. I didn't notice your message before I started replacing, and now I've basically gone through and replaced many of the traditional-first templates with {{zh | ....... | first=t}}, and many of the simplified-first with just {{zh}} (but I haven't done all of them...there are still several thousand more, so rather than trying to do them by hand I'm starting to fiddle with bot stuff). So things that already have first=t won't be changed if I update the template, but things that don't (i.e., any articles about mainland China stuff) will be changed, unless a simple way can be found to go and insert first=s into all of them. rʨanaɢ talk/contribs 00:19, 20 September 2009 (UTC)
AWB can insert first=s into templates which do not contain first=t, and I assume other bots could easily do the same. It should be ignored unless and until it's defined. kwami (talk) 07:02, 20 September 2009 (UTC)
It would have to be done by a bot, since there are over 6,000 articles that would need to be edited.
Also, about the suggetsion above for a template with more flexibility... I threw together a mock-up at User:Rjanag/zh-full (with an example in my sandbox), which gives the user full control (I think) over the order in which they display things. In most cases that much control isn't necessary (and indeed, the vast majority of combinations would be illogical...for instance, you would never put the literal translation or any of the romanizations before the Chinese characters), but after some more tweaks I could probably put it into mainspace in the off-chance that anyone wants more control (over, for example, the order in which various romanizations are displayed in a given article). rʨanaɢ talk/contribs 16:34, 20 September 2009 (UTC)
Well, if it's easy to do and not code intensive, why not. But you might wait until there is an actual demand for a particular option - it might never materialize, or materialize in a way we didn't expect. kwami (talk) 22:37, 20 September 2009 (UTC)


I agree we should not make first=s as the default. Further we should create {{zh-tw}} and {{zh-hk}}, to make first=t default (and Cantonese too for articles related to Hong Kong). 14.0.144.63 (talk) 16:56, 4 April 2013 (UTC)

I do not understand what you're saying. First of all, something has to be the default (unless we give it no default, which means that there will be an error when |first= is not provided, and that would just make it a pain for people to use). So if you're saying the default should not be simplified characters, then I guess you're saying you think traditional should be the default. As far as I have seen, there is no strong argument for or against making either one the default. I happen to be a user of mainland Chinese and thus I made the simplified stuff first, but nevertheless there is no compelling reason to change it.
Regarding your suggestion of making separate templates with different defaults, I must respectfully disagree. The entire purpose of creating this template was to consolidate everything into one template; before I did this, there were scores of different "zh" templates on Wikipedia and they were not internally consistent (i.e., some were no longer maintained, or didn't format in the same way as others). Your suggestion would re-introduce that problem. It's much better to have one template that does everything, and then when changes need to be made they only need to be made here. Furthermore, I don't see what problem your suggestion solves. It lets people not have to type "first=t" to get traditional characters first, but they still have to type that extra "-tw" or "-hk", so really you're only saving them a few characters. In fact you're costing them more characters, since this template has the option of setting a |first= default for the whole page (and thus you can get traditional characters first for the whole page, without having to enter |first=t every time), whereas under your suggestion if someone were writing a long article they'd have to use zh-tw or zh-hk over and over again. Quite simply, the current template is better. rʨanaɢ (talk) 22:13, 4 April 2013 (UTC)

Items should be comma-delimited

Where a term is given in more than one lang, the langs are usually separated by semicolons and items of a particular lang are separated by commas, e.g. <the language>: <the term itself>, <the transliteration>, <the transcription>; <another language>: <the term in that language>, ... . This one's items being comma-separated makes things a little confusing and disorderly. — Lfdder (talk) 19:30, 22 September 2013 (UTC)

I've added a delim param in the sandbox, compare:
Would anyone be against importing it? — Lfdder (talk) 19:39, 22 September 2013 (UTC)
Already discussed at length above. rʨanaɢ (talk) 09:57, 23 September 2013 (UTC)

There doesn't seem to be any opposition to this change.Lfdder (talk) 11:18, 23 September 2013 (UTC)

 Not done Then you don't seem to have read the discussion. rʨanaɢ (talk) 18:37, 23 September 2013 (UTC)
I've read it. The possibility of an optional param never came up. What's wrong with adding a delim param that'll have no effect on existing transclusions, but will make sense for when there's other langs listed? — Lfdder (talk) 18:47, 23 September 2013 (UTC)
I don't see the point of this, adding extra complexity and unnecessary variation. You write that 'items of a particular lang are separated by commas' but these are not terms in a language, as Chinese is not a single language, which causes particular problems. To illustrate:
  • {{zh | t=香港| s=香港| p=Xiānggǎng| j=Hoeng1gong2}}
    Chinese: 香港; pinyin: Xiānggǎng; Jyutping: Hoeng1gong2
Cantonese (represented by the Jyutping) and Mandarin are two separate languages, but they have the same written form. So they should be separated by semicolons except with 香港 where commas should appear. Which is impossible. And this is a relatively simple example. --JohnBlackburnewordsdeeds 19:37, 23 September 2013 (UTC)
You must be proud for having come up with such a brilliant distraction. Plainly, "Chinese", "pinyin" and "Jyutping" are related; Uyghur is not. Separating them all with semicolons is inappropriate. — Lfdder (talk) 19:58, 23 September 2013 (UTC)
Pinyin and Jyutping are no more related than French and Spanish. Also, as I already pointed out multiple times in the previous discussions, if you absolutely must use commas, {{zh-full}} already allows that. rʨanaɢ (talk) 04:27, 24 September 2013 (UTC)
What about my suggestion from that discussion back in 2011 about using semicolons to delimit within language families ("Chinese", "Japanese", "Mongolian", etc.) in the template while using commas to delimit varieties within those families ("pinyin", "Jyutping", "Peh-oe-ji", etc.)? Maybe that would be an acceptable compromise.  White Whirlwind  咨  06:03, 24 September 2013 (UTC)
Like I said in 2011, {{zh-full}} already allows that. Delimiters between families are usually not part of any template (because the different families are added by separate template), so anyone can use a semicolon there if they want. {{zh-full}} allows you to use commas between Chinese-related things. So I don't really see what the issue is. rʨanaɢ (talk) 08:00, 24 September 2013 (UTC)

Please change the link for "Cantonese Yale" to Yale romanization of Cantonese, as done in the sandbox[1]. Kanguole 22:40, 23 November 2013 (UTC)

Done thank you. Callanecc (talkcontribslogs) 05:11, 24 November 2013 (UTC)

Using Nihongo template and zh template together

There are some difficulties when trying to use both Nihongo and zh template together. Please see Template talk:Nihongo#Using Nihongo template and zh template together Rincewind42 (talk) 06:45, 1 January 2014 (UTC)

Language tagging for pinyin

It feels odd that, when multiple parameters are supplied (such as simplified Chinese: 优酷; traditional Chinese: 優酷; pinyin: yōukù, that the pinyin isn't tagged with {{lang}}.

Is there a reason why the pinyin isn't output as ''{{lang|zh-Latn|yōukù}}'' or ''{{lang|zh-Latn-pinyin|yōukù}}'' (yōukù) ? — OwenBlacker (Talk) 17:42, 8 April 2014 (UTC)

Agree. The pinyin is still Chinese, not English and so should be tagged as such. Either the using the template:lang and zh-latin / zh-Latn-pinyin as OwenBlacker said or else by using the template:transl such as ''{{transl|zh|yōukù}}''. Both have the same end result in the html code. Not just the pinyin, all the transliterations should be tagged similarly. Rincewind42 (talk) 05:35, 9 April 2014 (UTC)

Abbreviating the writing systems

I've just been looking at the current version of the article Youku and noticed that there is a lot of Chinese text not wrapped in {{zh}}, presumably to allow for abbreviation on repeated use.

I agree that we should spell out the writing system names on first use — such as Youku (simplified Chinese: 优酷; traditional Chinese: 優酷; pinyin: yōukù; lit. 'literally excellent (and) cool') — but it feels like we should allow for subsequent uses to do something more terse, like Victor Koo (S: 古永锵; T: 古永鏘; Gǔ Yǒngqiāng).

This feels like the kind of thing that could [relatively] easily be handled either by Lua templating or by a parameter (such as |terse=yes) that allows us to use the same template, but without having the words "simplified Chinese" and "traditional Chinese" littering articles all over the place. — OwenBlacker (Talk) 17:35, 8 April 2014 (UTC)

That reminds me. A while ago to explore the new scripting system/teach myself Lua I did a Lua version of this template on the test2 wiki,
Looking at it now it's broken: it's working but not displaying any Chinese characters, which is a bit of a problem. It also doesn't implement the Default ordering capability of this template, but I never saw a way to implement that.--JohnBlackburnewordsdeeds 18:45, 8 April 2014 (UTC)


I've tried copying it across, fixing some errors, changing the sandbox to use it, disabling the {{lang}} functionality as that depended on a Module I can't find here, and it otherwise seems to work, e.g.
the Module's at Module:Zh. Far from the most elegant programming but far easier to understand than the parser function.--JohnBlackburnewordsdeeds 19:14, 8 April 2014 (UTC)
I've added back the {{lang}} functionality as a function within the module, which also adds it to the appropriate 'Article containing xxx-language text' category, so it now does everything that {{zh}} does except the Default ordering capability.
My original motivation for this was to experiment with and learn the new Lua interface, but I picked this template as it looked like one that could benefit from a speedup. In my tests it is faster, but on most articles the difference will be negligible as the template is used so little, typically once or a few times. The article I used for testing, Mandarin Chinese profanity (see here for the test version) contains many instances of the template but it's exceptional in that.
So I would not advocate adopting Lua for performance reasons. But it does produce much more readable and maintainable code, with the current template being an especially complex one. This will become more of an issue over time as we switch over to Lua – expertise on and support for parser functions will decline. It's also likely that Lua will improve further, becoming perhaps faster and easier to use. For these reasons I think complex templates will have to switch sooner or later, and if there is good reason to such as to add more functionality then sooner makes the most sense here.--JohnBlackburnewordsdeeds 01:17, 9 April 2014 (UTC)
Regarding abreviations, have a look at Wikipedia talk:Manual of Style/China-related articles#Pinyin in article text where I suggested that deep within the article we need not label the text at all. The exception being in articles where other languages, such as Japanese or Korean, are included, when we should be explicitly clear what is what. I don't think the abbreviations S, T, P mean anything to most readers. For someone who has studied Chinese, they can make an educated guess. However, Wikipedia's target is to be an introduction to a subject. We should assume that readers don't know there is more than one form of Chinese writing or what pinyin or other systems might mean.
While we are on the topic about adding features to a new version, would it be possible to make the template automatically un-link the labels if used more than once on a page. That would save us from having to type links=no repetitively.
Another much more advanced, but I'm sure doable, feature would be to have a database of Chinese script/pinyin such that the editor need only fill in either the traditional or simplified Chinese and the other fields be generated via the database. I know that's a big jump but would fix allot of issues with existing articles where only one form of Chinese text exists and the later editors have to try to work out whither to tag it as t, s or c. -- Rincewind42 (talk) 15:26, 9 April 2014 (UTC)
I'm pretty sure linking only the first instance of the template can't be done: there's no way for templates to query other instances of themselves on the page, or to know if they're first (which might e.g. be different when previewing a section, so you could get the preview looking different to how it looks after being saved).--JohnBlackburnewordsdeeds 16:08, 9 April 2014 (UTC)
Having thought on your last suggestion I don't think it's a good idea. It's up to the editor adding the Chinese text via the template whether or not they specify a writing system or just leave it as 'Chinese'. As in many if not most cases it doesn't matter. In most cases on the English WP a bit of Chinese may be added for completeness, to i.e. provide the original characters of a Romanised word or name. Whether it's Simplified or Traditional is of little interest to the vast majority of readers. Those who know enough Chinese to know the difference between Simplified and Traditional can probably tell which it is, if either, themselves, and also know where to find those articles.
So if you see {{zh|中国}}, which generates Chinese: 中国, it's fine to leave it like that. Readers don't need to be told it's simplified Chinese, either as they don't understand Chinese so don't care, or if they do understand Chinese they can recognise it as simplified themselves so don't need to be told. There are cases where the traditional should be added – in this case in China for one – but it should be an editorial decision, not something the template does.--JohnBlackburnewordsdeeds 14:08, 10 April 2014 (UTC)

I've worked out how to do the default ordering in the module: add the list of articles to the module. This is easily done as there are only a handful of them – see Special:PrefixIndex/Template:Zh/. But even if there were hundreds it would be easily done. See e.g. Module:Check_ISO_639-1 for a table of hundreds of ISO codes which can be checked efficiently. Arguably this is much easier than the current method which puts the files in a hard to find place (took me a minute to find them) and also leaves them open to abuse as it would be easy to modify, add or move any of them without anyone knowing, unless they checked or were watching that particular file. If the module is protected then {{editprotected}} or similar can be used to add articles which means they'll also be checked before being added, to stop abuse/POV changes.

I've gone ahead and added this to Module:Zh. While adding I noticed one distinctly odd one which perhaps illustrates the problem with having these in small files that no-one looks at. One is for Chinese calendar but I can't see why t-first is needed for it. The template is only used once, in Chinese calendar #Cultural issues and I don't any Hong Kong/Taiwan association or other reason for putting traditional first.--JohnBlackburnewordsdeeds 00:59, 11 April 2014 (UTC)