1. Overview

In multi-user environments, we might need to change the user interface or graphical user interface (GUI) language to interact with the system in our preferred language. For instance, this task becomes essential when we want to personalize the computing environment and standardize its visual elements according to our native language.

In this tutorial, we’ll check out methods for changing the UI language on a Ubuntu 22.04 Xfce desktop.

Notably, our examples involve changing the UI language to Aragonese using the shell and the Language Support utility.

2. Using the Shell

We can change the UI language in Xfce through the shell in case we prefer command-line interactions.

Particularly, in this method, we’ll configure the locale settings and modify specific files to set the desired language as Aragonese.

For this, let’s open the terminal and use locale-gen to generate locale for Aragonese which is an_ES.UTF-8:

$ sudo locale-gen an_ES.UTF-8
Generating locales (this might take a while)...
  an_ES.UTF-8... done
Generation complete.

Once the locale generation is complete, we edit the ~/.i18n file in a text editor like nano:

$ sudo nano ~/.i18n

Then, we add the code to export the language-related environment variables:

export LANGUAGE=an_ES.utf8
export LANG=an_ES.utf8
export LC_ALL=an_ES.utf8

In the above script, we specify an_ES.utf8 as the value of the LANGUAGE, LANG, and LC_ALL variables, respectively.

Thus, we set the language, and default locale, and override all other locale settings with the Aragonese locale.

After adding the code, we press CTRL+O and Return to save the ~/.i18n file and CTRL+X to exit the nano editor:

saving .i18n script in xfce

Then, we modify the ~/.config/xfce4/xinitrc file to include the language settings during Xfce session initialization:

$ sudo nano ~/.config/xfce4/xinitrc

Next, we add the code in the ~/.config/xfce4/xinitrc file:

#!/bin/sh
if [ -f "$HOME/.i18n" ]; then
    . "$HOME/.i18n"
fi
. /etc/xdg/xfce4/xinitrc

In the above script, the if statement with the -f option checks if the $HOME/.i18n file exists. If so, the dot . which is shorthand for the source command, reads and executes commands from $HOME/.i18n containing the environment variable settings for UI language configurations.

Next, we source the /etc/xdg/xfce4/xinitrc script with . to incorporate its functionality into the current shell session.

After adding the code, we press CTRL+O and Return to save the ~/.config/xfce4/xinitrc file and CTRL+X to exit the nano editor:

saving content of xinitrc file in xfce linux

Lastly, we reboot the system to apply the language and switch to the new UI language:

$ reboot

Now, we open any application, such as Calendar on our system to test the configured settings:

viewing calendar in xfce for testing

As a result, we can see Aragonese as the UI language of the components of the Calendar application.

3. Using the Language Support Utility

In Xfce, Language Support is a graphical tool that enables us to manage the language-related configuration. Specifically, this method is often more user-friendly and doesn’t require extensive command-line interactions.

In particular, we use the Language Support tool to change the UI language of our Xfce desktop environment to Aragonese.

To do so, first, we type Language Support in the Activities menu and open the application:

opening language support in xfce linux

Then, we click on the Install/Remove Languages… button to install a new UI language:

clicking on install or remove languages button in language tab of language support

Next, we look for Aragonese in the Language list, mark its checkbox for installation, and click Apply:

installing aragonese language on xfce

After that, we drag the Aragonese entry at the top of the Language for menus and windows and click on the Apply system-wide button:

applying system wide language settings

Now, we enter the Password for root and click Authenticate:

entering system password for authentication to apply changes

This process may take a few minutes to apply the language changes to the system interface:

waiting for applying language changes on xfce

Then, we open the Log Out prompt window via the Activities menu to log out of  the current session:

logging out of current screen in xfce

After that, we enter the password to again log into the system:

logging in again in xfce

Now, we open any application like the Text Editor to test the UI language changes:

opening text editor for testing in xfce

Thus, we can see Aragonese as the UI language of the Text Editor on our desktop.

4. Conclusion

In this article, we learned different methods for changing the UI language of an Xfce desktop.

Particularly, we can edit the ~/.i18n in the shell to set the language-related environment variables. On the other hand, the Language Support utility enables us to change the UI language via a user-friendly interface.

Ultimately, we can select any of these methods based on our preference for using the command line or graphical user interface.