[libcalamares] Add ${LANG} to process expansions

This commit is contained in:
Adriaan de Groot 2024-02-26 22:33:17 +01:00
parent 0f2bceb72f
commit 028e9e68f9
2 changed files with 15 additions and 1 deletions

View File

@ -14,6 +14,7 @@
#include "JobQueue.h"
#include "compat/Variant.h"
#include "locale/Global.h"
#include "utils/Logger.h"
#include "utils/StringExpander.h"
#include "utils/System.h"
@ -77,6 +78,16 @@ get_gs_expander( System::RunLocation location )
expander.insert( QStringLiteral( "USER" ), gs->value( "username" ).toString() );
}
if ( gs )
{
const auto key = QStringLiteral( "LANG" );
const QString lang = Calamares::Locale::readGS( *gs, key );
if ( !lang.isEmpty() )
{
expander.insert( key, lang );
}
}
return expander;
}

View File

@ -12,6 +12,9 @@
# system from the point of view of the command (when run in the target
# system, e.g. when *dontChroot* is false, that will be `/`).
# - `USER` is replaced by the username, set on the user page.
# - `LANG` is replaced by the language chosen for the user-interface
# of Calamares, set on the welcome page. This may not reflect the
# chosen system language from the locale page.
#
# Variables are written as `${var}`, e.g. `${ROOT}`.
# Write `$$` to get a shell-escaped `\$` in the shell command.