Clocale

Namespaces

Namespaces are logical groupings used to organize your translation keys within a project. By categorizing translation keys into namespaces, you can maintain a clean and structured localization system that makes it easier to manage and scale as your project grows.


What Are Namespaces?

Namespaces allow you to segment your translation keys logically. This structure provides a few key benefits:

  • Organization: Keep your translation keys categorized based on functionality or sections of your application (e.g., auth, dashboard, common).
  • Scalability: As your project grows, the number of translation keys can increase significantly, and namespaces help you manage them efficiently.
  • Clarity: Namespaces provide context for your translation keys, making it easier to understand where each translation is used in the application.

Namespace


Filtering by Namespace

Clocale provides a Namespace Filter dropdown to help you easily navigate and manage translations within large projects.

How It Works

  • The Namespace Filter is located at the top of the Translations page.
  • It displays a dropdown list of all available namespaces in the current project.
  • Selecting a namespace filters the translations to show only the keys belonging to that specific namespace.

Namespace in Action

Let’s take an example of how it works:

  • You’re adding a translation for a button in your app.
  • You choose the auth namespace because the button is related to authentication (e.g., a login button).
  • In the translation form, you fill out:
    • Key: login_button
    • Value: "Log In"

The translation key will now reside within the auth namespace, helping to keep your project organized.


Benefits of This Approach

By assigning translations to namespaces directly while adding them, you gain the following advantages:

  • Better Organization : Group translations logically according to their functionality (e.g., auth, dashboard).
  • Flexibility : Easily create new namespaces as needed, and manage translations based on their respective categories.
  • Streamlined Management : Easily find and update translations as they are categorized within namespaces, improving maintenance efficiency.

On this page