apt: request translation when executing the mirror check
By setting the LANG variable and passing clean_locale=False, the apt-get command will be translated if the locale definition exists on the system. Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
parent
f284d25757
commit
7bb5742685
|
@ -173,7 +173,10 @@ class AptConfigurer:
|
|||
apt_cmd.append(
|
||||
f"-o{target}::DefaultEnabled=false")
|
||||
|
||||
proc = await astart_command(apt_cmd, stderr=subprocess.STDOUT)
|
||||
env = os.environ.copy()
|
||||
env["LANG"] = self.app.base_model.locale.selected_language
|
||||
proc = await astart_command(apt_cmd, stderr=subprocess.STDOUT,
|
||||
clean_locale=False, env=env)
|
||||
|
||||
async def _reader():
|
||||
while not proc.stdout.at_eof():
|
||||
|
|
|
@ -60,6 +60,7 @@ class TestAptConfigurer(SubiTestCase):
|
|||
self.model = Mock()
|
||||
self.model.mirror = MirrorModel()
|
||||
self.model.proxy = ProxyModel()
|
||||
self.model.locale.selected_language = "en_US.UTF-8"
|
||||
self.app = make_app(self.model)
|
||||
self.configurer = AptConfigurer(self.app, AsyncMock(), '')
|
||||
|
||||
|
|
Loading…
Reference in New Issue