Python xbmc.ISO_639_1 Examples
The following are 5
code examples of xbmc.ISO_639_1().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
xbmc
, or try the search function
.
Example #1
Source File: kodiops.py From plugin.video.netflix with MIT License | 5 votes |
def get_kodi_audio_language(iso_format=xbmc.ISO_639_1, use_fallback=True): """ Return the audio language from Kodi settings WARNING: when use_fallback is False, based on Kodi settings can also return values as: 'mediadefault', 'original' """ audio_language = json_rpc('Settings.GetSettingValue', {'setting': 'locale.audiolanguage'}) converted_lang = convert_language_iso(audio_language['value'], iso_format, use_fallback) if not converted_lang: if audio_language['value'] == 'default': # Kodi audio language settings is set as "User interface language" converted_lang = xbmc.getLanguage(iso_format, False) # Get lang. active else: converted_lang = audio_language['value'] return converted_lang
Example #2
Source File: kodiops.py From plugin.video.netflix with MIT License | 5 votes |
def get_kodi_subtitle_language(iso_format=xbmc.ISO_639_1): """ Return the subtitle language from Kodi settings """ subtitle_language = json_rpc('Settings.GetSettingValue', {'setting': 'locale.subtitlelanguage'}) if subtitle_language['value'] == 'forced_only': return subtitle_language['value'] return convert_language_iso(subtitle_language['value'], iso_format)
Example #3
Source File: kodiops.py From plugin.video.netflix with MIT License | 5 votes |
def convert_language_iso(from_value, iso_format=xbmc.ISO_639_1, use_fallback=True): """ Convert language code from an English name or three letter code (ISO 639-2) to two letter code (ISO 639-1) :param iso_format: specify the iso format (ISO_639_1 or ISO_639_2) :param use_fallback: if True when the conversion fails, is returned the current Kodi active language """ converted_lang = xbmc.convertLanguage(g.py2_encode(from_value), iso_format) if not use_fallback: return converted_lang converted_lang = converted_lang if converted_lang else xbmc.getLanguage(iso_format, False) # Get lang. active return converted_lang if converted_lang else 'en' if iso_format == xbmc.ISO_639_1 else 'eng'
Example #4
Source File: artworkprocessor.py From script.artwork.beef with MIT License | 5 votes |
def setlanguages(self): languages = [] if settings.language_override: languages.append(settings.language_override) if settings.language_fallback_kodi: newlang = pykodi.get_language(xbmc.ISO_639_1) if newlang not in languages: languages.append(newlang) if settings.language_fallback_en and 'en' not in languages: languages.append('en') self.autolanguages = languages log("Working language filter: " + str(languages))
Example #5
Source File: utils.py From script.module.clouddrive.common with GNU General Public License v3.0 | 5 votes |
def get_language_code(): import xbmc return xbmc.getLanguage(format=xbmc.ISO_639_1, region=True)