Offline text translation with Firefox
Foreign Language Skills
While all popular web browsers offer an online translation function, Mozilla Firefox lets you translate your texts offline while protecting your privacy.
Having foreign language text automatically translated in your web browser at the push of a button is an indispensable function that many users rely on every day. Virtually nobody seems to think about the fact that a service provider is translating the foreign language content into the desired target language. Although this does not incur any direct costs, this translation feature still comes at a price: The service providers analyze the translated data and then use the information for commercial purposes and profiling. Native Linux translation programs such as LibreTranslate [1] work in an offline mode, which means that they do not spy on your personal data. However, you have to install them and in some cases compile them from the source code.
Starting with version 118 released in September 2023, the free Firefox web browser and its derivatives include a translation function that can also be used offline. You can enable this translation function with just a few mouse clicks. Developed as part of the Bergamot project funded by the European Union at a cost just south of EUR3 million, Firefox Translations is based on various language models and is constantly being improved.
The developers have implemented the Firefox Translations function in Firefox in a similar way to the popular search engine operators. Two framed text segments appear next to each other in a separate tab in the browser window. You insert the text to be translated on the left, and the translated text appears on the right. Appropriate selection fields let users define the source and target languages.
Google, Microsoft, and others provide translation services that send the text entered in the left-hand panel to servers that they operate. When the text reaches the servers, it is not only translated, but also evaluated for further use in a totally nontransparent way. In contrast to this, Firefox Translator downloads a language model in the target language when translating for the first time. This is used for translation moving forward, and it operates completely without an Internet connection.
The Bergamot Project
The Bergamot project [2] is a collaboration between the University of Edinburgh, University of Sheffield, Charles University in Prague, the University of Tartu, and Mozilla. With the objective of developing translation tools that work with neural networks, these networks ultimately have enabled Mozilla to create an exclusively local extension for translating web pages in Firefox.
As a prerequisite, the entire infrastructure, including both the language models and the translation algorithms, must be capable of offline use without any restrictions. One particular challenge during development was efficiently programing the software so that it runs quickly on standard PC CPUs and does not require a dedicated GPU, as is often the case with deep learning solutions. Mozilla has also invited the user community to train the language models; it has set up a dedicated GitHub page [3] for this purpose. As a result, the existing language models are constantly being improved and new languages are also regularly being added to Firefox Translations.
Well-Kept Secret
Firefox's translation module can be used in various ways. The developers have hidden the interface in the browser. To enable Firefox Translations, you first need to open the web browser's configuration dialog by typing about:config in the address bar. After confirming the warning message, you will see an input line where you can enter the desired configuration option, translations in this case. The interface lists all the options it finds while you type. Find the browser.translations.enable line and change the value displayed in the middle from false to true by clicking on the small button with the two arrows on the right. You have now enabled the translation interface (Figure 1).
If you then open a new tab in the web browser and enter about:translations in the URL input bar, the application opens the conventional interface for translating text. You can use the two selection boxes above the source and target text input boxes to choose the languages. By default, Firefox automatically detects the source language.
Once you have added some text in the source input box on the left, you can specify one of the supported languages in Select language on the right. When using Firefox Translations for the first time, it can take some time for the translated text to appear on the right. Firefox first downloads the language model available for the target language and then translates the source text (Figure 2). If you want to configure the source language manually, you can specify it in the selection box above the left-hand window pane.
Manual Configuration
In Firefox and its derivatives, the developers have also adapted the settings dialog following the implementation of the translation feature. You can manually download individual or all language models from the list displayed in the Translations group of the Settings | General menu and integrate them with the browser by pressing the respective button (Figure 3). You can tell which language models are already installed by the label on the corresponding button: An installed model's button will read Remove instead of Install. If you don't have Internet access when selecting a target language for which a language model is not yet available, the application displays a note to this effect in the translation pane.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.