Namespaces

Last updated: December 03, 2024Author: Jakub Pomykała

Namespaces in SimpleLocalize allow you to group translations in an organized way. They are particularly useful when managing a large number of translations or when namespaces are already a part of your application structure.

How to use namespaces

Namespaces are optional, and you can organize them in any way that suits your application. They can group translations by feature, module, page, or any other relevant criteria.

Let's say you have a web application with two pages: Home and About. You can create two namespaces: home and about and put translations for each page in the corresponding namespace.

Namespaces in SimpleLocalize

Assign namespaces to translations

You can create and assign namespaces directly in the translation editor, where they appear as blue labels next to the translation keys.

Manage key

Right-click on a translation key and select Manage key. In the Namespace field, type the name of the namespace you want to assign to the translation or choose an existing namespace from the dropdown menu.

Assigning namespaces in the translation editor

Bulk actions

You can assign namespaces to multiple translations at once using the bulk actions feature. Enable selection mode by clicking on a translation key holding the Ctrl key and then select translations you want to assign a namespace to. Click on the Bulk actions button and choose Change namespace. Type the name of the namespace you want to assign to the translations or choose an existing namespace from the dropdown.

Assigning namespaces in the translation editor

Import translations with namespaces

When you import translations to SimpleLocalize from a file, you can assign a namespace to imported translation keys by selecting the namespace during the import process.

Import translations with namespaces

Export translations with namespaces

During the export process, you can choose to export translations with or without namespaces. Split by namespaces option will generate separate files for each namespace.

Export translations with namespaces

API and CLI

The SimpleLocalize API and CLI fully support namespaces. You can use them to manage translations, import/export files, and more.

Read more about the API and CLI in the API documentation and CLI documentation.

Translation hosting

When hosting translations via SimpleLocalize, you can fetch translations by namespace, making it easier to retrieve content for specific features, modules, or pages.

Read more about fetching translations by namespace in the Translation hosting documentation.

Filter translations by namespace

You can filter translations by namespace in the translation editor. Click on the 'Filters' button and select the namespace you want to filter translations by.

You can also quickly filter translations by namespace using the Filter by namespace option under right click on the translation key.

Filter translations by namespace
Was this helpful?