[[Template:catfix]]

Fragment of a discussion from User talk:Rua

Or rather why doesn't it work in any Hebrew category?

WikiTiki8923:21, 21 July 2015

Actually, I think I get why. But can it be fixed in the general case, since Hebrew is 99% of the time in the "Hebr" script?

WikiTiki8923:25, 21 July 2015
 

What's not working about it?

CodeCat23:25, 21 July 2015

Essentially, my new question is, how can I make "Hebr" the default script for Hebrew categories?

WikiTiki8915:23, 22 July 2015

The problem is that {{catfix}} tries to do script detection on some nonsense text inside the template, and the result is always Latn. There is no way to change that because the actual category fix is done by JavaScript, and Lua is no longer in the picture. JavaScript would need its own form of script detection.

CodeCat15:37, 22 July 2015

Then what's the point of {{catfix}} without an explicit sc= parameter?

WikiTiki8915:39, 22 July 2015

It marks the words in the language and makes them link to the proper section.

CodeCat15:45, 22 July 2015

Good point. What Lua could do is put in the default script to wherever the sc= would have went.

WikiTiki8915:47, 22 July 2015

What is the default script?

CodeCat15:48, 22 July 2015

Maybe we should add a new optional default_script field? Or just use the first script.

WikiTiki8915:50, 22 July 2015

Right now, script detection counts characters in each of the language's scripts, and returns the one with the most characters matched. So there's no "default". However, if all of a language's scripts return 0 matches, then "None" is returned as the script. So perhaps that's where the default could fit in; it would be a fallback. But keep in mind it would only apply if there are no characters from ANY of the language's scripts. Just a single "a" when Latn is included in the list of scripts will make it pick Latn, even if the remaining characters are all gibberish.

CodeCat15:54, 22 July 2015

Well we could make it apply in cases like {{catfix}} where there is no text known at Lua's run time.

WikiTiki8917:02, 22 July 2015