[[Module:scripts]]

Fragment of a discussion from User talk:Rua
Jump to navigation Jump to search

We can add lookup_script, similar to lookup_language, to Module:language utilities. I think data of scripts and languages should be in one module, we need both of them in almost all entries.

Z14:18, 21 July 2013

It's actually pretty rare to need the script name currently. Not that many entries need it.

CodeCat14:19, 21 July 2013

Yes... my mistake. Should we create a utility module for it? We only need one function.

Z14:29, 21 July 2013

I think we can add it to the language utilities module. Small modules have a relatively large overhead, because they have to be retrieved from the database.

CodeCat14:32, 21 July 2013

What about having one single function for both purposes, this way we can avoid duplication.

Z14:42, 21 July 2013

How do you mean?

CodeCat14:42, 21 July 2013

We can detect if the input is the code of a language or a script, from its first letter. But by merging Module:scripts to Module:languages, lookup_language doesn't need to know that, so we can use lookup_language for looking up both languages and scripts.

Z14:47, 21 July 2013

I think we should rather focus on speed. lookup_language is a very heavily used function, so we should try to keep it fast. String pattern/search operations would slow it down. I know that it can be useful to make "smart" functions, but it's easy to overdo it...

CodeCat14:49, 21 July 2013

I actually meant we should merge Module:scripts to Module:languages, the data in Module:scripts is relatively small.

Z14:57, 21 July 2013

So you want people to use "lang=Latn"? Huh?

CodeCat15:10, 21 July 2013

The parameter's name can be changed.

Z15:24, 21 July 2013

That's not what I mean. If we add scripts to Module:languages, then a template like {{term}} would accept "Latn" as a valid language.

CodeCat15:58, 21 July 2013

I see.

Z16:04, 21 July 2013