How to change language of google chrome in ubuntu

I want to change the language of google chrome in ubuntu. I went to default settings > advanced settings > languages > add languages and added French and moved it to the top of the languages list.

The I restarted chrome but I see the menus and everything else in English itself. How can I change the language of the chrome browser?


Solution 1:

According to this link in Google support foruns Chrome will automatically display in the default system language for your computer. So, if you want to change Chrome Language, you should change Ubuntu default language.

Solution 2:

To make the great solution provided by Krzysztof permanent (e.g. opening Google Chrome by clicking on the Google Chrome icon in the launcher bar / taskbar, or from the application menu):

Edit the file /opt/google/chrome/google-chrome and add an export for the env variable at the very top of the file.

export LANGUAGE=DE_at

The file might be located elsewhere on your system, I'm running Ubuntu 20.04.

How to find the location?

Trace back the symbolic link trail for google-chrome inside your /bin or /usr/bin directories. At some point you will find the script.

This solution works right now, things might change in future. However, installing the next update for Google Chrome resets the file, so this file editing procedure needs to be done after each update.

Fixing the file can be automated

  • create a script file somewhere, e.g. inside /usr/bin
sudo touch /usr/bin/fixchrome
  • fix permissions
sudo chmod 755 /usr/bin/fixchrome 
  • edit the file, e.g. using gedit
sudo gedit /usr/bin/fixchrome
  • paste the following code into the editor and save the file (don't forget to adapt the CHROMESCRIPT path to your local machine AND the language you want to use inside the export LANGUAGE statement)
#!/bin/sh

CHROMESCRIPT=/opt/google/chrome/google-chrome

cp $CHROMESCRIPT $CHROMESCRIPT.old -f
head $CHROMESCRIPT.old -n1 > $CHROMESCRIPT
echo 'export LANGUAGE="DE_AT"' >> $CHROMESCRIPT
tail $CHROMESCRIPT.old -n+2 >> $CHROMESCRIPT

On execution, this script will insert the export LANGUAGE statement in line two of the present script and will save the original script as $CHROMESCRIPT.old

Since the script is located in a directory being part of our $PATH, we can open a terminal and execute the script via

sudo fixchrome

after each Google Chrome update.

For reference: how does my google-chrome file look like?

This is the content of my original /opt/google/chrome/google-chrome

#!/bin/bash
#
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Let the wrapped binary know that it has been run through the wrapper.
export CHROME_WRAPPER="`readlink -f "$0"`"

HERE="`dirname "$CHROME_WRAPPER"`"

# We include some xdg utilities next to the binary, and we want to prefer them
# over the system versions when we know the system versions are very old. We
# detect whether the system xdg utilities are sufficiently new to be likely to
# work for us by looking for xdg-settings. If we find it, we leave $PATH alone,
# so that the system xdg utilities (including any distro patches) will be used.
if ! which xdg-settings &> /dev/null; then
  # Old xdg utilities. Prepend $HERE to $PATH to use ours instead.
  export PATH="$HERE:$PATH"
else
  # Use system xdg utilities. But first create mimeapps.list if it doesn't
  # exist; some systems have bugs in xdg-mime that make it fail without it.
  xdg_app_dir="${XDG_DATA_HOME:-$HOME/.local/share/applications}"
  mkdir -p "$xdg_app_dir"
  [ -f "$xdg_app_dir/mimeapps.list" ] || touch "$xdg_app_dir/mimeapps.list"
fi

# Always use our versions of ffmpeg libs.
# This also makes RPMs find the compatibly-named library symlinks.
if [[ -n "$LD_LIBRARY_PATH" ]]; then
  LD_LIBRARY_PATH="$HERE:$HERE/lib:$LD_LIBRARY_PATH"
else
  LD_LIBRARY_PATH="$HERE:$HERE/lib"
fi
export LD_LIBRARY_PATH

export CHROME_VERSION_EXTRA="stable"

# We don't want bug-buddy intercepting our crashes. http://crbug.com/24120
export GNOME_DISABLE_CRASH_DIALOG=SET_BY_GOOGLE_CHROME

# Sanitize std{in,out,err} because they'll be shared with untrusted child
# processes (http://crbug.com/376567).
exec < /dev/null
exec > >(exec cat)
exec 2> >(exec cat >&2)

# Note: exec -a below is a bashism.
exec -a "$0" "$HERE/chrome" "$@"

More automation?

To even avoid the step of calling the script you could to the following: Create another script which checks if your export is part of the script. If not, the line will be inserted. The script content would be

#!/bin/sh

CHROMESCRIPT=/opt/google/chrome/google-chrome
cat $CHROMESCRIPT | grep DE_AT || fixchrome

That script needs to be called in regular time intervals, maybe on every boot. Make sure to call this script with root privileges.