Module talk:scripts
Typo? (in read-only module)
[edit]"[Ss]script$" --> "[Ss]cript$" --PiefPafPier (talk) 10:36, 3 February 2018 (UTC)
- @PiefPafPier: That was incorrect, but it turns out that it wasn't actually needed, because no script names contain "script". — Eru·tuon 10:54, 3 February 2018 (UTC)
Custom methods for specific scripts
[edit]@Benwing2, Erutuon, Surjection I was thinking it might be useful to have some way of giving certain scripts custom methods.
For example, it would be useful for Tibetan (Tibt
) to have a findMainStack
method, which finds the letter stack which precedes the vowel in a given syllable. This is used in transliteration and sorting (as Tibetan sorts by main stack, not first letter). The algorithm for this is currently implemented by Module:Tibt-common, but (importantly) the rules it uses can differ by language; e.g. what clusters and affixes are valid etc. So, for example, Lhasa Tibetan and Dzongkha might favour different main stacks for the exact same letter sequence of letters, and therefore would be sorted + transliterated differently. Module:Tibt-translit and Module:Tibt-sortkey don’t know/care about the specifics of this, as they simply ask Module:Tibt-common what the main stack is and go from there.
For the sake of simplicity, it would make more sense for the Tibt
script object to just have a findMainStack
method, which takes the language object as a parameter. Everything else can just be wrapped up in that. Theknightwho (talk) 16:54, 30 March 2023 (UTC)
- Why can't the method in Module:Tibt-common take a language object? — SURJECTION / T / C / L / 16:55, 30 March 2023 (UTC)
- @Surjection I meant to say “syllable and language object as parameters”. There’s no reason it can’t be done in Module:Tibt-common - I just think it would be useful to have a standardised way of doing things in situations like this. I’m sure that other scripts have specific methods that apply to them, too. Theknightwho (talk) 17:01, 30 March 2023 (UTC)
- @Theknightwho Can you elaborate how this would work? The concept of "main stack" seems Tibetan-specific so I wouldn't want to burden the general code with knowledge of it. Benwing2 (talk) 20:35, 30 March 2023 (UTC)
- @Benwing2 I suggest we have an auxiliary module that contains any custom methods, which Module:scripts fetches based on the script’s
methods
value in Module:scripts/data. We can’t put them in the data module due tomw.loadData
, but we can still avoid loading them except when needed by doing it like this. Theknightwho (talk) 20:44, 30 March 2023 (UTC)
- @Benwing2 I suggest we have an auxiliary module that contains any custom methods, which Module:scripts fetches based on the script’s
- @Theknightwho Can you elaborate how this would work? The concept of "main stack" seems Tibetan-specific so I wouldn't want to burden the general code with knowledge of it. Benwing2 (talk) 20:35, 30 March 2023 (UTC)
- @Surjection I meant to say “syllable and language object as parameters”. There’s no reason it can’t be done in Module:Tibt-common - I just think it would be useful to have a standardised way of doing things in situations like this. I’m sure that other scripts have specific methods that apply to them, too. Theknightwho (talk) 17:01, 30 March 2023 (UTC)