Skip to content

Commit

Permalink
Fix: textdomain and translation loading (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmigf authored Dec 31, 2024
1 parent 64dde47 commit 4c36ec1
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 4 deletions.
53 changes: 53 additions & 0 deletions languages/woocommerce-pdf-ips-mpdf.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright (C) 2024 WP Overnight
# This file is distributed under the GPLv2 or later.
msgid ""
msgstr ""
"Project-Id-Version: PDF Invoices & Packing Slips for WooCommerce - mPDF 2.5.4\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-pdf-ips-mpdf\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-12-30T17:06:48+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.11.0\n"
"X-Domain: woocommerce-pdf-ips-mpdf\n"

#. Plugin Name of the plugin
#: wcpdf-mpdf.php
msgid "PDF Invoices & Packing Slips for WooCommerce - mPDF"
msgstr ""

#. Plugin URI of the plugin
#: wcpdf-mpdf.php
msgid "https://github.com/wpovernight/woocommerce-pdf-ips-mpdf"
msgstr ""

#. Description of the plugin
#: wcpdf-mpdf.php
msgid "Utilizes the mPDF engine as an alternative for converting HTML to PDF."
msgstr ""

#. Author of the plugin
#: wcpdf-mpdf.php
msgid "WP Overnight"
msgstr ""

#. Author URI of the plugin
#: wcpdf-mpdf.php
msgid "https://www.wpovernight.com"
msgstr ""

#. translators: 1. Plugin name, 2: Core plugin version, 3: Core plugin name
#: wcpdf-mpdf.php:132
msgid "%1$s requires at least version %2$s of %3$s to be installed and activated."
msgstr ""

#: wcpdf-mpdf.php:291
msgid "RTL support"
msgstr ""

#: wcpdf-mpdf.php:297
msgid "Enables RTL support natively for templates."
msgstr ""
13 changes: 9 additions & 4 deletions wcpdf-mpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Author URI: https://www.wpovernight.com
* License: GPLv2 or later
* License URI: https://opensource.org/licenses/gpl-license.php
* Text Domain: woocommerce-pdf-invoices-packing-slips
* Text Domain: woocommerce-pdf-ips-mpdf
*/

use Symfony\Component\DomCrawler\Crawler;
Expand Down Expand Up @@ -94,6 +94,11 @@ public function output() {

endif; // class_exists

add_action( 'init', 'wpo_wcpdf_mpdf_load_translations' );
function wpo_wcpdf_mpdf_load_translations(): void {
load_plugin_textdomain( 'woocommerce-pdf-ips-mpdf', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}

add_filter( 'wpo_wcpdf_pdf_maker', 'wpo_wcpdf_pdf_maker_mpdf' );
function wpo_wcpdf_pdf_maker_mpdf( string $class ): string {
if ( ! wpo_wcpdf_mpdf_check_dependencies() ) {
Expand Down Expand Up @@ -124,7 +129,7 @@ function wpo_wcpdf_mpdf_check_dependencies(): bool {
function wpo_wcpdf_mpdf_notice_core_plugin_requirement(): void {
$error_message = sprintf(
/* translators: 1. Plugin name, 2: Core plugin version, 3: Core plugin name */
__( '%1$s requires at least version %2$s of %3$s to be installed and activated.', 'woocommerce-pdf-invoices-packing-slips' ),
__( '%1$s requires at least version %2$s of %3$s to be installed and activated.', 'woocommerce-pdf-ips-mpdf' ),
'<strong>PDF Invoices & Packing Slips for WooCommerce - mPDF</strong>',
'<strong>3.8.4</strong>',
'<a href="https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/">PDF Invoices & Packing Slips for WooCommerce</a>'
Expand Down Expand Up @@ -283,13 +288,13 @@ function wpo_wcpdf_mpdf_rtl_support( $settings_fields, $page, $option_group, $op
$settings_fields[] = array(
'type' => 'setting',
'id' => 'rtl_support',
'title' => __( 'RTL support', 'woocommerce-pdf-invoices-packing-slips' ),
'title' => __( 'RTL support', 'woocommerce-pdf-ips-mpdf' ),
'callback' => 'checkbox',
'section' => 'general_settings',
'args' => array(
'option_name' => $option_name,
'id' => 'rtl_support',
'description' => __( 'Enables RTL support natively for templates.', 'woocommerce-pdf-invoices-packing-slips' ),
'description' => __( 'Enables RTL support natively for templates.', 'woocommerce-pdf-ips-mpdf' ),
)
);

Expand Down

0 comments on commit 4c36ec1

Please sign in to comment.