Rather than a script, how about a plugin that adds a new scripting function?
I’ve seen requests for this sort of thing before, so I thought I’d whip up a plugin to provide the functionality. It’s a first release at version 0.01 but it is so simple and seems to work reasonably well. Unfortunately, one current limitation is that the full language names returned are pretty much in English, because the list I’ve used is from the SIL Website and it is primarily in English.
If you try it, please let me know if it does what you’re looking for. I especially want to hear if there are any bugs! I haven’t yet submitted this to the official Picard plugins repository.
Language Name [Download]
This plugin provides a new scripting function $language_name()
that allows the user to retrieve the full name for a three-character language code for use within scripts.
Usage
The function is used as $language_name(code)
, where code
is the three-character language code.
It will typically be used to expand the %language%
and %_releaselanguage%
tags.
For example, $language_name(%language%)
will return English
if the language code is eng
, or Gwichʼin
if the language code is gwi
, or Klingon
if the code is tlh
. (Yes, Klingon is actually officially recognized in the ISO 639-3 list of languages.)
If an unknown code (or no code) is entered, the function will return an empty string.
Technical Notes
This function uses the ISO 639-3 (Part 2B) language codes, provided by the www.iso639-3.sil.org website.