mirror of
https://github.com/lutris/lutris
synced 2024-09-04 23:13:35 +00:00
Add get_lang_and_country utility
This commit is contained in:
parent
9c5ab57ab6
commit
965164d229
|
@ -20,6 +20,7 @@ from lutris.util import system
|
|||
from lutris.util.egs.egs_launcher import EGSLauncher
|
||||
from lutris.util.log import logger
|
||||
from lutris.util.strings import slugify
|
||||
from lutris.util.i18n import get_lang_and_country
|
||||
|
||||
EGS_GAME_ART_PATH = os.path.expanduser("~/.cache/lutris/egs/game_box")
|
||||
EGS_GAME_BOX_PATH = os.path.expanduser("~/.cache/lutris/egs/game_box_tall")
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
"""Language and translation utilities"""
|
||||
# Standard Library
|
||||
import locale
|
||||
|
||||
|
||||
|
@ -7,3 +6,10 @@ def get_lang():
|
|||
"""Return the 2 letter language code used by the system"""
|
||||
user_locale, _user_encoding = locale.getlocale()
|
||||
return user_locale[:2]
|
||||
|
||||
|
||||
def get_lang_and_country():
|
||||
"""Return language code and country for the current user"""
|
||||
user_locale, _user_encoding = locale.getlocale()
|
||||
lang_code, country = user_locale.split('-' if '-' in locale else '_')
|
||||
return lang_code, country
|
||||
|
|
Loading…
Reference in a new issue