Module talk:Linguistic

Latest comment: 1 year ago by Jonesey95 in topic require('strict')

derterminer

edit

Bonjour, dans la routine p.of il y a une variable nommée derterminer mais l'argument est determiner – ça pourrait être un problème? -- Aisano (talk) 20:49, 28 July 2015 (UTC)Reply

  Fixed, @Aisano:   Thank you. --Jarekt (talk) 14:27, 8 September 2016 (UTC)Reply

Template:Of/fr

edit

Template:Of/fr logic before LUA was:

		
		if derterminer then
			if number == 'plural' then
				return 'des ' .. word
			elseif p.vowelfirst(raw) then
				return 'de l\'' .. word
			elseif gender == 'feminine' then
				return 'de la ' .. word
			else
				return 'du ' .. word
			end
		else
			if p.vowelfirst(raw) then
				return 'd\'' .. word
			else
				return 'de ' .. word
			end
		end

instead of current

		

if number == 'plural' then return 'des ' .. word elseif p.vowelfirst(raw) then return 'de l\'' .. word elseif gender == 'feminine' then return 'de la ' .. word elseif derterminer then return 'du ' .. word else return 'de ' .. word end

they both can not be right. @Zolo: which one is correct? --Jarekt (talk) 03:49, 7 September 2016 (UTC)Reply

@Jarekt: the second one is incorrect. I hope the first one is correct ! --Zolo (talk) 07:22, 8 September 2016 (UTC)Reply
  Thank you. --Jarekt (talk) 12:11, 8 September 2016 (UTC)Reply

Hello, there is still a bug in French. Eg https://commons.wikimedia.org/wiki/Category:Grave_of_Loutreuil_(P%C3%A8re-Lachaise,_division_89)?uselang=fr It is written Tombeau d’Loutreuil and not Tombeau de Loutreuil. Pyb (talk) 18:14, 11 September 2016 (UTC)Reply

  Fixed Thanks for reporting. --Jarekt (talk) 23:07, 11 September 2016 (UTC)Reply

Conj with nil arguments

edit

@Jarekt: Would be better if the conj function just ignored nil arguments instead of raising an error as it currently seesm to do. I think this is the reason for the bug in template:Temporary Exhibition that can be seen in User:Zolo/test. Inserting the following code from frwiki at the beginning of p.conj should do the trick:

	if (not args) then
		return nil
	end
	local newargs = {}
	for i, j in pairs(args) do
		if type(j) ~= 'nil' then
			table.insert(newargs, j)
		end
	end
	args = newargs

-preprocess +callParserFunction

edit

To reduce resources, please do this safe sobstitution:

frame:preprocess( "{{int:lang}}" )
↓
frame:callParserFunction( 'int', 'lang' )

Here explainations. --Valerio Bozzolan (talk) 22:42, 22 October 2017 (UTC)Reply

Conj

edit

@Geagea: The following code:

{{#invoke:Linguistic|conjfromWiki|אחת|שתיים|שלוש|type=and|lang=he}}

Generates wrong output:

"אחת, שתיים ו שלוש"

instead of

"אחת, שתיים ושלוש"

(e.g no need to separator after and)

The function wordand should add space/separator after "and" except for he. To fix it I suggest to replace from (line 136):

return mw.text.listToText(args, comma, wordand(lang) .. wordsep)

to:

return mw.text.listToText(args, comma, wordand(lang))

and rewrite wordand to add the sep:

local function wordand(lang)
	local wordsep = mw.message.new( "Word-separator" ):inLanguage(lang):plain()
	local andtable = { -- languages with a problem with the MediaWiki:And
		no = ' og',
		pl = ' i',
		zh = '和',
		ja = 'および'
	}
	if andtable[lang] then
		return andtable[lang] .. wordsep
	elseif lang == 'he' then
		return 'ו' -- no wordsep
	else
		return mw.message.new( "and" ):inLanguage(lang):plain() .. wordsep
	end
end

I didn't verify the code - before saving a fix please use Preview page with this template and test it on a page using this module. Eran (talk) 15:27, 23 April 2018 (UTC)Reply

Working perfect. Thanks. -- Geagea (talk) 17:44, 23 April 2018 (UTC)Reply

Same for Arabic

edit

{{Edit request}} @Jarekt or another friendly admin: Would you mind to add:

	elseif lang == 'ar' then
		return ' و' -- no wordsep

after the case for Hebrew behind line 29? Thanks in advance, --Marsupium (talk) 20:43, 29 October 2018 (UTC), 14:10, 30 October 2018 (UTC)Reply

I am looking at this....--Jarekt (talk) 13:02, 30 October 2018 (UTC)Reply
Marsupium, could you add a test case to Module:Linguistic/testcases which would use some Arabic phrase, as I did with Hebrew? --Jarekt (talk) 13:08, 30 October 2018 (UTC)Reply
The editor's incapability to position the cursor in RTL text has killed me, but now done. Thank you for your effort! --Marsupium (talk) 13:50, 30 October 2018 (UTC)Reply
I had forgotten the first space above, now inserted, with the edit now proposed above performed in Module:Linguistic/sandbox it now passes the updated Module talk:Linguistic/sandbox/testcases. Thank you for merging it! --Marsupium (talk) 14:10, 30 October 2018 (UTC)Reply
  Done I actually went with a slightly different implementations. --Jarekt (talk) 02:05, 31 October 2018 (UTC)Reply
Thanks a lot! --Marsupium (talk) 16:05, 31 October 2018 (UTC)Reply

Edit request: Do not use fallback for word order and fix else case

edit

{{Edit request}} Please push the changes in Module:Linguistic/sandbox to Module:Linguistic!
Currently in p.noungroup() the word order of adjective and noun falls back to other languages and finally English. I don't think this is a good idea, a general fallback to other languages for a matter of grammar seems to be a bad idea and the code suggests it was also intended differently. With the else block fixed it will render as "noun (adjective)" when order is not known.
Also, I've added the order for many new languages.
I've added testcases to Module:Linguistic/testcases. With the changes all tests in Module talk:Linguistic/testcases should pass. Thanks in advance, --Marsupium (talk) 22:16, 6 August 2019 (UTC), 23:52, 6 August 2019 (UTC)Reply

  Done Awesome! Thank you! -- User: Perhelion 15:06, 7 September 2019 (UTC)Reply

Edit request: update data of p.noungroup()

edit

{{Edit request}} Please push the changes in Module:Linguistic/sandbox to Module:Linguistic! Or if it would be possible to degrade the edit protection level to allow Template editors I can do it myself. Thanks for either action! --Marsupium (talk) 12:49, 18 November 2019 (UTC)Reply

  Done --Jarekt (talk) 13:46, 18 November 2019 (UTC)Reply

comma-separator usage

edit

I'm not sure if I should put {{Edit request}} or not.

For the recent several years, people from zhwiki are discussing the "chaotic" usages of MediaWiki:Comma-separator, see a recent zh:Wikipedia:互助客栈/其他#其他討論事項, see also this archive, there are several concerns that lead community members to split to two parties, one "pro-、" and one "pro-,". Someone pointed that our Commons Module:Linguistic is also using comma-separator, so zhwiki users has to follow how Commons ruled that message, but this results many zhwiki templates broken, and hence results verbally assaults (?) from many other zhwiki users. --Liuxinyu970226 (talk) 05:17, 3 May 2020 (UTC)Reply

require('strict')

edit

{{Edit protected}} As per the new lua feature mentioned at m:Tech/News/2022/42, could require('Module:No globals') be replaced with require('strict') -- WOSlinker (talk) 17:21, 25 October 2022 (UTC)Reply

  Done. Jonesey95 (talk) 04:48, 26 October 2022 (UTC)Reply
Return to "Linguistic" page.