Skip to content

Commit

Permalink
Merge pull request #1052 from brainstormforce/transfix
Browse files Browse the repository at this point in the history
EPS-1008 Fix: Translation files not loading issue
  • Loading branch information
sushmak02 authored Jan 27, 2025
2 parents 9cb69f5 + 862ccb3 commit 30ab7dd
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 34 deletions.
49 changes: 22 additions & 27 deletions inc/class-header-footer-elementor.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public function __construct() {
self::$elementor_instance = Elementor\Plugin::instance();

$this->includes();
add_action( 'init', [ $this, 'load_textdomain' ] );

add_action( 'init', [ $this, 'load_hfe_textdomain' ] );

add_filter(
'elementor/admin-top-bar/is-active',
Expand Down Expand Up @@ -428,49 +428,44 @@ public function includes() {
}

/**
* Loads textdomain for the plugin.
*
* @return void
*/
public function load_textdomain() {
// load_plugin_textdomain( 'header-footer-elementor' );

// Default languages directory.
* Loads textdomain for the plugin.
*
* @return void
*/
public function load_hfe_textdomain() {

// Default languages directory for "header-footer-elementor".
$lang_dir = HFE_DIR . 'languages/';

/**
* Filters the languages directory path to use for plugin.
* Filters the languages directory path to use for AffiliateWP.
*
* @param string $lang_dir The languages directory path.
*/
$lang_dir = apply_filters( 'hfe_languages_directory', $lang_dir );

// Traditional WordPress plugin locale filter.
global $wp_version;

$get_locale = get_locale();

if ( $wp_version >= 4.7 ) {
$get_locale = get_user_locale();
}

/**
* Language Locale for plugin
* Language Locale for Ultimate Elementor
*
* @var $get_locale The locale to use.
* Uses get_user_locale()` in WordPress 4.7 or greater,
* otherwise uses `get_locale()`.
* @var $get_locale The locale to use. Uses get_user_locale()` in WordPress 4.7 or greater,
* otherwise uses `get_locale()`.
*/
$locale = apply_filters( 'plugin_locale', $get_locale, 'header-footer-elementor' );
$mofile = sprintf( '%1$s-%2$s.mo', 'header-footer-elementor', $locale );

// Setup paths to current locale file.
$mofile_global = WP_LANG_DIR . '/plugins/' . $mofile;
$mofile_local = $lang_dir . $mofile;

error_log( 'mofile_global: ' . $mofile_global );
error_log( 'mofile_local: ' . $mofile_local );

$mofile_global = WP_LANG_DIR . '/header-footer-elementor/' . $mofile;

if ( file_exists( $mofile_global ) ) {
// Look in global /wp-content/languages/header-footer-elementor/ folder.
load_textdomain( 'header-footer-elementor', $mofile_global );
Expand All @@ -479,7 +474,7 @@ public function load_textdomain() {
load_textdomain( 'header-footer-elementor', $mofile_local );
} else {
// Load the default language files.
load_plugin_textdomain( 'header-footer-elementor' );
load_plugin_textdomain( 'header-footer-elementor', false, $lang_dir );
}
}

Expand Down
2 changes: 2 additions & 0 deletions inc/class-hfe-settings-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ public function enqueue_admin_scripts() {
HFE_VER,
true
);

wp_set_script_translations( 'header-footer-elementor-react-app', 'header-footer-elementor', HFE_DIR . 'languages' );

wp_localize_script(
'header-footer-elementor-react-app',
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.11.0","source":"src\/Components\/Dashboard\/TemplateSection.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Build Websites 10x Faster with Templates":["Bouw websites 10x sneller met sjablonen"],"Choose from our professionally designed websites to build your site faster, with easy customization options.":["Kies uit onze professioneel ontworpen websites om je site sneller te bouwen, met eenvoudige aanpassingsopties."],"View Templates":["Bekijk sjablonen"]}}}
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.10.0","source":"src\/Components\/Dashboard\/TemplateSection.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Build Websites 10x Faster with Templates":["Bouw websites 10x sneller met sjablonen"],"Choose from our professionally designed websites to build your site faster, with easy customization options.":["Kies uit onze professioneel ontworpen websites om je site sneller te bouwen, met eenvoudige aanpassingsopties."],"View Templates":["Bekijk sjablonen"]}}}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.11.0","source":"src\/Components\/Dashboard\/WelcomeContainer.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Welcome to Ultimate Addons for Elementor!":["Welkom bij Ultimate Addons voor Elementor!"],"We're excited to help you supercharge your website-building experience. Effortlessly design stunning websites with our comprehensive range of free and premium widgets and features.":["We zijn enthousiast om je te helpen je website-bouwervaring te verbeteren. Ontwerp moeiteloos verbluffende websites met ons uitgebreide assortiment gratis en premium widgets en functies."],"Create Header\/Footer":["Maak Header\/Footer"],"Create New Page":["Maak nieuwe pagina"],"Read full guide":["Lees volledige gids"]}}}
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.10.0","source":"src\/Components\/Dashboard\/WelcomeContainer.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Welcome to Ultimate Addons for Elementor!":["Welkom bij Ultimate Addons voor Elementor!"],"We're excited to help you supercharge your website-building experience. Effortlessly design stunning websites with our comprehensive range of free and premium widgets and features.":["We zijn enthousiast om je te helpen je website-bouwervaring te verbeteren. Ontwerp moeiteloos verbluffende websites met ons uitgebreide assortiment gratis en premium widgets en functies."],"Create Header\/Footer":["Maak Header\/Footer"],"Create New Page":["Maak nieuwe pagina"],"Read full guide":["Lees volledige gids"]}}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.11.0","source":"src\/Components\/Dashboard\/UltimateFeatures.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Advanced Heading":["Geavanceerde kop"],"Modal Popup":["Modale popup"],"Info Box":["Info Box"],"Post Layouts":["Berichtindelingen"],"Pricing Cards":["Prijskaarten"],"Form Stylers and more...":["Formulierstyling en meer..."],"Unlock Ultimate Features":["Ontgrendel ultieme functies"],"Create Stunning Designs with the Pro Version!":["Cre\u00eber verbluffende ontwerpen met de Pro-versie!"],"Get access to advanced widgets and features to create the website that stands out!":["Krijg toegang tot geavanceerde widgets en functies om de website te cre\u00ebren die opvalt!"],"Upgrade Now":["Upgrade nu"],"Compare Free vs Pro":["Vergelijk gratis vs pro"],"Column Showcase":["Kolom Showcase"]}}}
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.10.0","source":"src\/Components\/Dashboard\/UltimateFeatures.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Advanced Heading":["Geavanceerde kop"],"Modal Popup":["Modale popup"],"Info Box":["Info Box"],"Post Layouts":["Berichtindelingen"],"Pricing Cards":["Prijskaarten"],"Form Stylers and more...":["Formulierstyling en meer..."],"Unlock Ultimate Features":["Ontgrendel ultieme functies"],"Create Stunning Designs with the Pro Version!":["Cre\u00eber verbluffende ontwerpen met de Pro-versie!"],"Get access to advanced widgets and features to create the website that stands out!":["Krijg toegang tot geavanceerde widgets en functies om de website te cre\u00ebren die opvalt!"],"Upgrade Now":["Upgrade nu"],"Compare Free vs Pro":["Vergelijk gratis vs pro"],"Column Showcase":["Kolom Showcase"]}}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.11.0","source":"src\/Components\/NavMenu.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Settings":["Instellingen"],"Header & Footer Builder":["Kop & Voettekst Builder"],"Dashboard":["Dashboard"],"Widgets":["Widgets"],"Templates":["Sjablonen"],"Free vs Pro":["Gratis vs Pro"],"Get Pro":["Krijg Pro"],"Free":["Gratis"],"Version":["Versie"],"Useful Resources":["Nuttige bronnen"],"Getting Started":["Aan de slag"],"How to use widgets":["Hoe widgets te gebruiken"],"How to use features":["Hoe functies te gebruiken"],"How to use templates":["Hoe sjablonen te gebruiken"],"Contact us":["Neem contact met ons op"]}}}
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.10.0","source":"src\/Components\/NavMenu.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Settings":["Instellingen"],"Header & Footer Builder":["Kop & Voettekst Builder"],"Dashboard":["Dashboard"],"Widgets":["Widgets"],"Templates":["Sjablonen"],"Free vs Pro":["Gratis vs Pro"],"Get Pro":["Krijg Pro"],"Free":["Gratis"],"Version":["Versie"],"Useful Resources":["Nuttige bronnen"],"Getting Started":["Aan de slag"],"How to use widgets":["Hoe widgets te gebruiken"],"How to use features":["Hoe functies te gebruiken"],"How to use templates":["Hoe sjablonen te gebruiken"],"Contact us":["Neem contact met ons op"]}}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.11.0","source":"src\/Components\/Dashboard\/QuickAccess.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Quick Access":["Snelle toegang"],"Contact Us":["Neem contact met ons op"],"Help Centre":["Helpcentrum"],"Request a Feature":["Vraag een functie aan"]}}}
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.10.0","source":"src\/Components\/Dashboard\/QuickAccess.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Quick Access":["Snelle toegang"],"Contact Us":["Neem contact met ons op"],"Help Centre":["Helpcentrum"],"Request a Feature":["Vraag een functie aan"]}}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.11.0","source":"src\/Components\/HeaderLine.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Formerly Elementor Header & Footer Builder":["Voorheen Elementor Header & Footer Builder"]}}}
{"translation-revision-date":"2024-12-05T10:53:31+00:00","generator":"WP-CLI\/2.10.0","source":"src\/Components\/HeaderLine.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"en","plural-forms":"nplurals=2; plural=(n != 1);"},"Formerly Elementor Header & Footer Builder":["Voorheen Elementor Header & Footer Builder"]}}}

0 comments on commit 30ab7dd

Please sign in to comment.