• derrida

    (@derrida)


    so i already asked here a question, but i need some help with the following questions:

    at the moment my theme uses this code:

    function gutfse_translation_setup() {
    // First, try loading translations from the theme's local languages folder
    load_theme_textdomain('gutrs', get_template_directory() . '/languages');

    // Then, fallback to the centralized languages folder
    load_theme_textdomain('gutrs', WP_LANG_DIR . '/themes');
    }
    add_action('init', 'gutfse_translation_setup');

    so i do use the init hook, but if i turn on debug i still get that my text domain is loading too early and i should use the init hook?

    another issue is that before i would install my theme and the interface would immediatly be in hebrew, that is the right language. so now i need to install my theme and then on the server go to the languages folder and create a themes folder and then paste my files?!! what is the point ? it just complecate things!

    is there a way to tell wordpress not to use the languages/themes folder? i want it to be as before, when i install my theme, everything is working automatically?

Viewing 1 replies (of 1 total)
  • mayuripatel

    (@mayuripatel)

    Hello @derrida

    1. Use after_setup_theme Instead of init
    function gutfse_translation_setup() {
    // First, try loading translations from the theme's local languages folder
    load_theme_textdomain('gutrs', get_template_directory() . '/languages');
    }
    add_action('after_setup_theme', 'gutfse_translation_setup');

    2. Override the Centralized Folder : open your theme’s functions.php and add below code

    function gutfse_translation_setup() {
    // Force WordPress to load translations only from the theme's languages folder
    load_theme_textdomain('gutrs', get_template_directory() . '/languages');
    }
    add_action('after_setup_theme', 'gutfse_translation_setup');

    this will Prevent WordPress from looking in languages/themes.
    Load translations directly from your theme’s languages folder.

Viewing 1 replies (of 1 total)

The topic ‘load text domain issue’ is closed to new replies.