Merge branch '3.1.x-stable'

main
Adriaan de Groot 7 years ago
commit 9fe85e592f

@ -43,9 +43,11 @@ LocaleConfiguration::fromLanguageAndLocation( const QString& languageLocale,
const QStringList& availableLocales,
const QString& countryCode )
{
LocaleConfiguration lc = LocaleConfiguration();
LocaleConfiguration lc;
// Note that the documentation how this works is in packages.conf
QString language = languageLocale.split( '_' ).first();
lc.myLanguageLocaleBcp47 = QLocale(language).bcp47Name();
lc.myLanguageLocaleBcp47 = QLocale(language).bcp47Name().toLower();
QStringList linesForLanguage;
for ( const QString &line : availableLocales )
@ -288,7 +290,7 @@ LocaleConfiguration::isEmpty() const
QMap< QString, QString >
LocaleConfiguration::toMap()
LocaleConfiguration::toMap() const
{
QMap< QString, QString > map;
@ -324,3 +326,9 @@ LocaleConfiguration::toMap()
return map;
}
QString
LocaleConfiguration::toBcp47() const
{
return myLanguageLocaleBcp47;
}

@ -35,16 +35,21 @@ public:
bool isEmpty() const;
QMap< QString, QString > toMap() const;
// Note that the documentation how this works is in packages.conf
QString toBcp47() const;
// These become all uppercase in locale.conf, but we keep them lowercase here to
// avoid confusion with locale.h.
QString lang, lc_numeric, lc_time, lc_monetary, lc_paper, lc_name, lc_address,
lc_telephone, lc_measurement, lc_identification;
QString myLanguageLocaleBcp47;
QMap< QString, QString > toMap();
// If the user has explicitly selected language (from the dialog)
// or numbers format, set these to avoid implicit changes to them.
bool explicit_lang, explicit_lc;
private:
QString myLanguageLocaleBcp47;
};
#endif // LOCALECONFIGURATION_H

@ -489,8 +489,10 @@ LocalePage::updateGlobalStorage()
->insert( "locationRegion", location.region );
Calamares::JobQueue::instance()->globalStorage()
->insert( "locationZone", location.zone );
Calamares::JobQueue::instance()->globalStorage()
->insert( "locale", m_selectedLocaleConfiguration.myLanguageLocaleBcp47);
const QString bcp47 = m_selectedLocaleConfiguration.toBcp47();
Calamares::JobQueue::instance()->globalStorage()->insert( "locale", bcp47 );
cDebug() << "Updated locale globals, BCP47=" << bcp47;
// If we're in chroot mode (normal install mode), then we immediately set the
// timezone on the live system.

@ -332,7 +332,10 @@ def subst_locale(plist):
"""
locale = libcalamares.globalstorage.value("locale")
if not locale:
return plist
# It is possible to skip the locale-setting entirely.
# Then pretend it is "en", so that {LOCALE}-decorated
# package names are removed from the list.
locale = "en"
ret = []
for packagedata in plist:
@ -378,20 +381,20 @@ def run_operations(pkgman, entry):
global group_packages, completed_packages, mode_packages
for key in entry.keys():
entry[key] = subst_locale(entry[key])
group_packages = len(entry[key])
package_list = subst_locale(entry[key])
group_packages = len(package_list)
if key == "install":
_change_mode(INSTALL)
if all([isinstance(x, str) for x in entry[key]]):
pkgman.install(entry[key])
if all([isinstance(x, str) for x in package_list]):
pkgman.install(package_list)
else:
for package in entry[key]:
for package in package_list:
pkgman.install_package(package)
elif key == "try_install":
_change_mode(INSTALL)
# we make a separate package manager call for each package so a
# single failing package won't stop all of them
for package in entry[key]:
for package in package_list:
try:
pkgman.install_package(package)
except subprocess.CalledProcessError:
@ -400,10 +403,10 @@ def run_operations(pkgman, entry):
libcalamares.utils.warning(warn_text)
elif key == "remove":
_change_mode(REMOVE)
pkgman.remove(entry[key])
pkgman.remove(package_list)
elif key == "try_remove":
_change_mode(REMOVE)
for package in entry[key]:
for package in package_list:
try:
pkgman.remove([package])
except subprocess.CalledProcessError:
@ -412,9 +415,9 @@ def run_operations(pkgman, entry):
libcalamares.utils.warning(warn_text)
elif key == "localInstall":
_change_mode(INSTALL)
pkgman.install(entry[key], from_local=True)
pkgman.install(package_list, from_local=True)
completed_packages += len(entry[key])
completed_packages += len(package_list)
libcalamares.job.setprogress(completed_packages * 1.0 / total_packages)
libcalamares.utils.debug(pretty_name())
@ -458,7 +461,7 @@ def run():
completed_packages = 0
for op in operations:
for packagelist in op.values():
total_packages += len(packagelist)
total_packages += len(subst_locale(packagelist))
if not total_packages:
# Avoids potential divide-by-zero in progress reporting

@ -76,7 +76,7 @@ update_db: true
# pre-script: touch /tmp/installing-vi
# post-script: rm -f /tmp/installing-vi
#
# The pre- and post-scripts are optional, but not both optional: using
# The pre- and post-scripts are optional, but you cannot leave both out: using
# "package: vi" with neither script option will trick Calamares into
# trying to install a package named "package: vi", which is unlikely to work.
#
@ -84,11 +84,16 @@ update_db: true
# packages for software based on the selected system locale. By including
# the string LOCALE in the package name, the following happens:
#
# - if the system locale is English (generally US English; en_GB is a valid
# localization), then the package is not installed at all,
# - otherwise $LOCALE or ${LOCALE} is replaced by the Bcp47 name of the selected
# system locale, e.g. nl_BE. Note that just plain LOCALE will not be replaced,
# so foo-LOCALE will be unchanged, while foo-$LOCALE will be changed.
# - if the system locale is English (any variety), then the package is not
# installed at all,
# - otherwise $LOCALE or ${LOCALE} is replaced by the **lower-cased** BCP47
# name of the **language** part of the selected system locale (not the
# country/region/dialect part), e.g. selecting *nl_BE* will use *nl*
# here.
#
# Take care that just plain LOCALE will not be replaced, so foo-LOCALE will
# be left unchanged, while foo-$LOCALE will be changed. However, foo-LOCALE
# **will** be removed from the list of packages, if English is selected.
#
# The following installs localizations for vi, if they are relevant; if
# there is no localization, installation continues normally.
@ -127,6 +132,7 @@ update_db: true
operations:
- install:
- vi
- vi-${LOCALE}
- wget
- binutils
- remove:

@ -25,6 +25,6 @@ requirements:
# If any of these conditions are not met, the user cannot
# continue past the welcome page.
required:
- storage
# - storage
- ram
- root
# - root

Loading…
Cancel
Save