Localization

This software offers 100% localization support and coverage. Moreover, it makes managing and maintaining localization-related language strings and files exceptionally easy. It provides a significantly better solution compared to frameworks like Laravel and others.

Characteristics of localization

  1. Module-based localization

    Each module includes a dedicated localization directory named Language, where all language files for that module can be stored. These files are organized into respective language-specific subdirectories. For instance, English language files should be placed under a subdirectory named en. We will refer you to a detailed guide later in this chapter.

    Module basis localization

  2. Usage of multiple language files

    Unlike Laravel and many other frameworks, we avoid using a single language file to store all language keys for the application. We find that maintaining a single file becomes increasingly challenging as the software grows larger. To address this, we organize multiple language files based on modules and file types (i.e., controllers, views and etc.) for easier maintainability.

    Multiple language files

  3. Naming and organization of language files

    We recommend aligning the naming and organization of language files with the structure used for views and controllers. This approach enhances maintainability. However, this is not a strict rule, just a recommendation.

    Language file naming and organization

  4. Language keys and string practices

    We do not use special formats for language keys, such as concatenated strings with underscores (i.e., lang_Key). Such formats can make view files harder to read, complicate the organization of language keys, and require coming up with unique names for every string, one of the more time-consuming aspects of programming.

    To simplify this process, we use the exact same text string as the language key, with one exception: replace "." in language keys with "[dot]". When needed, nesting can also be used to better organize language keys.

    Language strings and keys

    For longer language keys, such as language keys of paragraphs, we recommend using the first few words of the paragraph followed by "..." as the language key for clarity and simplicity. And for the language string, use PHP's Heredoc notation. Check this language file for better understanding: [app_root]\Nudasoft\StaticPages\Language\en\Views\StaticPages\UserAgreementPage.php.

    Longer language strings and keys

To learn more about localization, please refer to the Localization chapter in the CodeIgniter4 documentation.

Copyright © Nudasoft.