Eisspeedway

Module talk:Lang-zh: Difference between revisions

Content deleted Content added
Lowercase sigmabot III (talk | contribs)
m Archiving 1 discussion(s) to Module talk:Lang-zh/Archive 5) (bot
Line 92: Line 92:


Hello, can a parameter for [[Foochow Romanized]] be created? --[[User:Lousysofa|Lousysofa]] ([[User talk:Lousysofa|talk]]) 17:02, 27 March 2023 (UTC)
Hello, can a parameter for [[Foochow Romanized]] be created? --[[User:Lousysofa|Lousysofa]] ([[User talk:Lousysofa|talk]]) 17:02, 27 March 2023 (UTC)

== Template-protected edit request on 14 October 2023 ==

{{edit template-protected|Module:Lang-zh|answered=no}}
Diff with my sandbox implementation:
{{diffsandbox|Module:Lang-zh|rev1=1117460852|rev2=1180117223}}

This does three major things, things that address real perennial limitations with the {{tlx|zh}} template:
* It enables the use of multiple, correctly quoted glosses (literal translations), delineated by commas.
* It allows one to select one of the terms, and puts it before the rest in brackets, an extremely common presentation when inserting Chinese text inline in paragraphs and tables.
* It now uses double quotes for the {{para|tr}} parameter, for "full translations" instead of glosses, as is prescribed in the MOS.

Examples:
:{{tlx|Lang-zh/sandbox|c=我|p{{=}}wǒ|l{{=}}I, me|j{{=}}ngo<nowiki><sup>5</sup></nowiki>|out{{=}}j}}
:↓
:{{Lang-zh/sandbox|c=我|p=wǒ|j=ngo<sup>5</sup>|l=I, me|out=j}}
:{{hr}}
:{{tlx|Lang-zh/sandbox|s{{=}}中华|t{{=}}中華|p{{=}}Zhōnghuá|l{{=}}China|out{{=}}p|labels{{=}}no}}
:↓
:{{Lang-zh/sandbox|s=中华|t=中華|p=Zhōnghuá|l=China|out=p|labels=no}}
:{{tlx|Lang-zh/sandbox|s{{=}}她刚刚离开了|l{{=}}she's just left|out{{=}}l}}
:↓
:{{Lang-zh/sandbox|s=她刚刚离开了|l=she's just left|out=l}}
:{{hr}}
:{{tlx|Lang-zh/sandbox|s{{=}}电脑|t{{=}}電腦|tr{{=}}computer|p{{=}}diànnǎo|l{{=}}electric brain|out{{=}}tr|labels{{=}}no}}
:↓
:{{Lang-zh/sandbox|s=电脑|t=電腦|tr=computer|p=diànnǎo|l=electric brain|out=tr|labels=no}}
{{hr}}
I was apprehensive about patching the template, but I'm pretty sure I haven't broken anything, I'm sure someone more experienced than I will take a look-see before it gets merged. :) [[User:Remsense|<span style="border-radius:3px 0 0 3px;padding:4px 3px;background:#1E816F;color:#fff">'''Remsense'''</span>]][[User talk:Remsense|<span lang="zh" style="border:1px solid #1E816F;border-radius:0 2px 2px 0;padding:2px;color:#000">聊</span>]] 17:20, 14 October 2023 (UTC)

Revision as of 17:20, 14 October 2023

add new translation parameter "tr"

could someone implement these small changes to add a Translation parameter? the concept of literal translation is limiting in use cases for translating texts...

diff --git a/lang-zh.lua b/lang-zh.lua
index 7a8791c..1fe24a5 100644
--- a/lang-zh.lua
+++ b/lang-zh.lua
@@ -29,6 +29,7 @@ local labels = {
 	["poj"] = "Pe̍h-ōe-jī",
 	["zhu"] = "Zhuyin Fuhao",
 	["l"] = "lit.",
+	["tr"] = "trans.",
 }
 
 -- article titles for wikilinks for each part
@@ -115,7 +116,7 @@ function p._Zh(args)
 	end
 
 	-- based on setting/preference specify order
-	local orderlist = {"c", "s", "t", "p", "tp", "w", "j", "cy", "sl", "poj", "zhu", "l"}
+	local orderlist = {"c", "s", "t", "p", "tp", "w", "j", "cy", "sl", "poj", "zhu", "l", "tr"}
 	if (t1) then
 		orderlist[2] = "t"
 		orderlist[3] = "s"
@@ -186,7 +187,7 @@ function p._Zh(args)
 				-- add span for language if needed
 				params = {["lang"] = ISOlang[part]}
 				val = mw.text.tag({name="span",attrs=params, content=val})
-			elseif (part == "l") then
+			elseif ((part == "l") or (part == "tr")) then
 				-- put literals in quotes
 				val = "'" .. val .. "'"
 			end

talk@TRANSviada 01:39, 27 February 2021 (UTC)[reply]

@Jonesey95: @Pppery: @Xaosflux: @Firefly: @Earl Andrew: @Tol: help?talk@TRANSviada 22:27, 25 November 2021 (UTC)[reply]
@HJ Mitchell: can you have a look at this?talk@TRANSviada 21:13, 25 November 2021 (UTC)[reply]
Sorry, I'd have no idea what I was doing. HJ Mitchell | Penny for your thoughts? 21:19, 25 November 2021 (UTC)[reply]
@HJ Mitchell:Do you mean back when you created this template? I implemented the above changes in Template:Lang-zh/sandbox/tr pretty much by copying what the already existing l (literal translation), so it works just as that but with different letter and abbreviation, and am using it at Shizuka (band), so you can have a look that it works. Those are really small changes. The only thing that could go wrong is if the elseif was implemented wrong, but it work as expected in Shizuka (band).talk@TRANSviada 21:59, 25 November 2021 (UTC)[reply]
Erm, it looks like I just protected it, back in 2014 (seven and a half years ago!), almost certainly from an RfPP request. As far as I know, I've never made a substantive edit to any Lua module. I write articles, block vandals, and sometimes clear admin backlogs but I don't get involved in technical matters. Sorry. Try a different admin. HJ Mitchell | Penny for your thoughts? 22:13, 25 November 2021 (UTC)[reply]
cc @Primefac: @Number 57: @Izno: @DannyS712: --talk@TRANSviada 03:16, 25 November 2021 (UTC)[reply]
Why is Template:Lang-zh/sandbox/tr being used in mainspace? There are seventeen uses in Shizuka (band); there should be none. --Redrose64 🌹 (talk) 22:29, 12 May 2021 (UTC)[reply]
Fixed by Frietjes. --Redrose64 🌹 (talk) 09:41, 5 November 2021 (UTC)[reply]
 Not done Please make your edits in the sandbox and test this first. Once sandboxed and validated, feel free to reactivate the edit request. — xaosflux Talk 22:38, 25 November 2021 (UTC)[reply]
@Xaosflux: I just made it there the sandbox. What do you mean by test? Unit test or use case test? If the latter see https://en.wikipedia.org/wiki/Sandbox/TRANSviada/Lang-zh/tr.talk@TRANSviada 23:37, 25 November 2021 (UTC)[reply]
requeued for update. — xaosflux Talk 00:26, 26 November 2021 (UTC)[reply]
 Done * Pppery * it has begun... 17:09, 5 December 2021 (UTC)[reply]

Traditional first, optionally

If you saw the article of the Cantonese movie, Bio Zombie, you'd notice that the simplified Chinese characters are displayed fisrt, even though the title is in Cantonese. There is no way of altering which appears first, since the template mandates simplified characters first then traditional characters. --Mahmudmasri (talk) 16:23, 16 March 2021 (UTC)[reply]

You can alter which appears first. Use the parameter |first=t to put the traditional script first. See Template:Lang-zh#Ordering. Rincewind42 (talk) 08:21, 21 February 2022 (UTC)[reply]

Link to Wiktionary entry

Would it also be desirable to add an option to link the Chinese text to their respective entries in Wiktionary? Perhaps something like wikt=yes would render a {{Lang-zh|t=中國|s=中国|wikt=yes}} entry as:

simplified Chinese: 中国; Traditional Chinese characters: 中國

This surrounds each entry using {{wikt-lang|zh|...}}. — Umofomia (talk) 19:00, 19 August 2022 (UTC)[reply]

I just tried implementing the functionality myself in the sandbox and it appears to work:
simplified Chinese: 中国; traditional Chinese: 中國
I don't currently have template editor privileges to commit this change to the main template but I can look into requesting it. — Umofomia (talk) 21:03, 19 August 2022 (UTC)[reply]

Foochow Romanized/Bàng-uâ-cê

Hello, can a parameter for Foochow Romanized be created? --Lousysofa (talk) 17:02, 27 March 2023 (UTC)[reply]

Template-protected edit request on 14 October 2023

Diff with my sandbox implementation: diff

This does three major things, things that address real perennial limitations with the {{zh}} template:

  • It enables the use of multiple, correctly quoted glosses (literal translations), delineated by commas.
  • It allows one to select one of the terms, and puts it before the rest in brackets, an extremely common presentation when inserting Chinese text inline in paragraphs and tables.
  • It now uses double quotes for the |tr= parameter, for "full translations" instead of glosses, as is prescribed in the MOS.

Examples:

{{Lang-zh/sandbox|p=wǒ|l=I, me|j=ngo<sup>5</sup>|out=j}}
Jyutping: ngo5 (Chinese: ; pinyin: ; lit. 'I', 'me')

{{Lang-zh/sandbox|s=中华|t=中華|p=Zhōnghuá|l=China|out=p|labels=no}}
Zhōnghuá (中华; 中華; 'China')
{{Lang-zh/sandbox|s=她刚刚离开了|l=she's just left|out=l}}
lit. 'she's just left' (Chinese: 她刚刚离开了)

{{Lang-zh/sandbox|s=电脑|t=電腦|tr=computer|p=diànnǎo|l=electric brain|out=tr|labels=no}}
"computer" (电脑; 電腦; diànnǎo; 'electric brain')

I was apprehensive about patching the template, but I'm pretty sure I haven't broken anything, I'm sure someone more experienced than I will take a look-see before it gets merged. :) Remsense 17:20, 14 October 2023 (UTC)[reply]