Merge pull request #6807 from mglae/le11_locale_gbm_fix

locale addon: fix call of localedef, update language and settings format, REV 103
This commit is contained in:
CvH 2022-08-15 18:33:32 +02:00 committed by GitHub
commit 32b7df7013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 62 additions and 14 deletions

View File

@ -1,3 +1,6 @@
103:
- Fix localedef call, add error detection
102: 102:
- Include localedef - Include localedef

View File

@ -2,7 +2,7 @@
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) # Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="locale" PKG_NAME="locale"
PKG_REV="102" PKG_REV="103"
PKG_ARCH="any" PKG_ARCH="any"
PKG_DEPENDS_TARGET="toolchain glibc" PKG_DEPENDS_TARGET="toolchain glibc"
PKG_SECTION="service" PKG_SECTION="service"
@ -34,10 +34,9 @@ addon() {
if [ "${l}" = "POSIX" ]; then if [ "${l}" = "POSIX" ]; then
continue continue
fi fi
locales+="|${l}" locales+="$(echo -e '\\\n <option>'"${l}"'</option>')"
done done
locales="${locales:1}"
sed -e "s/@LOCALES@/${locales}/" \ sed -e "s|@LOCALES@|${locales}|" \
-i ${ADDON_BUILD}/${PKG_ADDON_ID}/resources/settings.xml -i ${ADDON_BUILD}/${PKG_ADDON_ID}/resources/settings.xml
} }

View File

@ -1,7 +1,37 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <?xml version="1.0" ?>
<settings> <settings version="1">
<category label="30000"> <section id="service.locale">
<setting label="30001" id="charmap" type="select" default="UTF-8" values="UTF-8" enable="false" /> <category id="configuration" label="30000" help="">
<setting label="30002" id="locale" type="select" default="en_GB" values="@LOCALES@" /> <group id="1">
<setting id="charmap" type="string" label="30001" help="">
<level>0</level>
<default>UTF-8</default>
<constraints>
<options>
<option>UTF-8</option>
</options>
</constraints>
<dependencies>
<dependency type="enable">
<condition on="property" name="InfoBool">false</condition>
</dependency>
</dependencies>
<control type="list" format="string">
<heading>30001</heading>
</control>
</setting>
<setting id="locale" type="string" label="30002" help="">
<level>0</level>
<default>en_GB</default>
<constraints>
<options>@LOCALES@
</options>
</constraints>
<control type="list" format="string">
<heading>30002</heading>
</control>
</setting>
</group>
</category> </category>
</section>
</settings> </settings>

View File

@ -38,8 +38,20 @@ class Monitor(xbmc.Monitor):
if os.path.isdir(localepath) == False: if os.path.isdir(localepath) == False:
os.environ['I18NPATH'] = i18npath os.environ['I18NPATH'] = i18npath
subprocess.call([os.path.join(path, 'bin/localedef'), '-f', charmap, rc = subprocess.run([os.path.join(path, 'bin/localedef'), '-v', '-f', charmap,
'-i', locale, localepath]) '-i', locale, localepath], capture_output=True,
stdin=subprocess.DEVNULL)
if rc.returncode not in [0, 1]:
xbmc.log(repr(rc), xbmc.LOGERROR)
try:
os.rmdir(localepath)
except OSError as e:
pass
if os.path.isfile(profile):
os.unlink(profile)
xbmcgui.Dialog().ok('Locale', strings(30004).format(lang))
return
if os.path.isdir(profiled) == False: if os.path.isdir(profiled) == False:
os.makedirs(profiled) os.makedirs(profiled)

View File

@ -17,3 +17,7 @@ msgstr ""
msgctxt "#30003" msgctxt "#30003"
msgid "Locale changed to {}. Please reboot to apply globally." msgid "Locale changed to {}. Please reboot to apply globally."
msgstr "" msgstr ""
msgctxt "#30004"
msgid "Creating locale {} failed. Aborting."
msgstr ""

View File

@ -1,4 +1,4 @@
<settings> <settings version="2">
<setting id="charmap" value="UTF-8" /> <setting id="charmap" default="true">UTF-8</setting>
<setting id="locale" value="en_GB" /> <setting id="locale" default="true>en_GB</setting>
</settings> </settings>