Skip to content

Commit ab6f369

Browse files
committed
Add Text Domain and Localization Abillity
1 parent 81ddbf8 commit ab6f369

File tree

4 files changed

+27
-19
lines changed

4 files changed

+27
-19
lines changed

README.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
=== WooCommerce External Product Embed ===
22
Author: Caleb Burks
3-
Tags: woocommerce, products, embed, external'
4-
Requires at least: 1.0
5-
Tested up to: 4.1.1
6-
Stable tag: 4.1.1
3+
Tags: woocommerce, products, embed, external
4+
Requires at least: 4.0
5+
Tested up to: 4.1
6+
Text Domain: wcepe
77
License: GPL v3 or later
88
License URI: http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
99

classes/class-woocommerce-external-product-embed-admin.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,54 +20,54 @@ function wcepe_settings_init( ) {
2020

2121
add_settings_section(
2222
'wcepe_pluginPage_section',
23-
__( 'Connect to External Store', 'wordpress' ),
23+
__( 'Connect to External Store', 'wcepe' ),
2424
array( $this, 'wcepe_settings_section_callback' ),
2525
'pluginPage'
2626
);
2727

2828
add_settings_field(
2929
'wcepe_text_field_0',
30-
__( 'Consumer Key', 'wordpress' ),
30+
__( 'Consumer Key', 'wcepe' ),
3131
array( $this, 'wcepe_text_field_0_render' ),
3232
'pluginPage',
3333
'wcepe_pluginPage_section'
3434
);
3535

3636
add_settings_field(
3737
'wcepe_text_field_1',
38-
__( 'Consumer Secret', 'wordpress' ),
38+
__( 'Consumer Secret', 'wcepe' ),
3939
array( $this, 'wcepe_text_field_1_render' ),
4040
'pluginPage',
4141
'wcepe_pluginPage_section'
4242
);
4343

4444
add_settings_field(
4545
'wcepe_text_field_2',
46-
__( 'Store Home URL', 'wordpress' ),
46+
__( 'Store Home URL', 'wcepe' ),
4747
array( $this, 'wcepe_text_field_2_render' ),
4848
'pluginPage',
4949
'wcepe_pluginPage_section'
5050
);
5151

5252
add_settings_field(
5353
'wcepe_text_field_3',
54-
__( 'Transient Set Time <br> (in seconds)', 'wordpress' ),
54+
__( 'Transient Set Time <br> (in seconds)', 'wcepe' ),
5555
array( $this, 'wcepe_text_field_3_render' ),
5656
'pluginPage',
5757
'wcepe_pluginPage_section'
5858
);
5959

6060
add_settings_field(
6161
'wcepe_text_field_4',
62-
__( 'Delete Active Transients', 'wordpress' ),
62+
__( 'Delete Active Transients', 'wcepe' ),
6363
array( $this, 'wcepe_text_field_4_render' ),
6464
'pluginPage',
6565
'wcepe_pluginPage_section'
6666
);
6767

6868
add_settings_field(
6969
'wcepe_text_field_5',
70-
__( 'Delete Expired Transients', 'wordpress' ),
70+
__( 'Delete Expired Transients', 'wcepe' ),
7171
array( $this, 'wcepe_text_field_5_render' ),
7272
'pluginPage',
7373
'wcepe_pluginPage_section'
@@ -105,7 +105,7 @@ function wcepe_text_field_3_render( ) {
105105
function wcepe_text_field_4_render( ) {
106106
$options = get_option( 'wcepe_settings' );
107107
?>
108-
<a href="<?php echo admin_url( 'options-general.php?page=embed_external_woocommerce_products&amp;action=clear_transients' ); ?>" class="button">Clear Transients</a>
108+
<a href="<?php echo admin_url( 'options-general.php?page=embed_external_woocommerce_products&amp;action=clear_transients' ); ?>" class="button"><?php echo __( 'Clear Transients', 'wcepe' ); ?></a>
109109
<?php
110110

111111
if ( ! empty( $_GET['action'] ) ) {
@@ -149,7 +149,7 @@ function delete_external_product_transients( ) {
149149
function wcepe_text_field_5_render( ) {
150150
$options = get_option( 'wcepe_settings' );
151151
?>
152-
<a href="<?php echo admin_url( 'options-general.php?page=embed_external_woocommerce_products&amp;action=clear_expired_transients' ); ?>" class="button">Clear Transients</a>
152+
<a href="<?php echo admin_url( 'options-general.php?page=embed_external_woocommerce_products&amp;action=clear_expired_transients' ); ?>" class="button"><?php echo __( 'Clear Transients', 'wcepe' ); ?></a>
153153
<?php
154154

155155
if ( ! empty( $_GET['action'] ) ) {
@@ -192,22 +192,22 @@ function delete_external_expired_product_transients( ) {
192192

193193
function display_success_message() {
194194
if ( ! empty( $_GET['action'] ) && $_GET['action'] == 'clear_transients' ) {
195-
echo '<div class="updated"><p>Transients Cleared</p></div>';
195+
echo '<div class="updated"><p>' . __( 'Transients Cleared', 'wcepe' ) . '</p></div>';
196196
} else if ( ! empty( $_GET['action']) && $_GET['action'] == 'clear_expired_transients' ) {
197-
echo '<div class="updated"><p>Expired Transients Cleared</p></div>';
197+
echo '<div class="updated"><p>' . __( 'Expired Transients Cleared', 'wcepe' ) . '</p></div>';
198198
}
199199
}
200200

201201
function wcepe_settings_section_callback( ) {
202202
//echo $this->display_success_message();
203-
echo __( 'You can find instructions here: <a href="http://docs.woothemes.com/document/woocommerce-rest-api/" target="_blank">Generating API keys</a>', 'wordpress' );
203+
echo __( 'You can find instructions here: <a href="http://docs.woothemes.com/document/woocommerce-rest-api/" target="_blank">Generating API keys</a>', 'wcepe' );
204204
}
205205

206206
function wcepe_options_page( ) {
207207
?>
208208
<form action='options.php' method='post'>
209209

210-
<h2>WooCommerce External Product Embed</h2>
210+
<h2><?php echo __( 'WooCommerce External Product Embed', 'wcepe' ); ?></h2>
211211

212212
<?php
213213
settings_fields( 'pluginPage' );

classes/class-woocommerce-external-product-embed.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,16 @@ public function __construct () {
99
if ( is_admin() ) {
1010
require_once 'class-woocommerce-external-product-embed-admin.php';
1111
}
12-
12+
13+
add_action( 'plugins_loaded', 'wcepe_text_domain' );
14+
1315
add_shortcode( 'external_product', array( $this, 'external_product_shortcode' ) );
1416
}
1517

18+
public function wcepe_text_domain() {
19+
load_plugin_textdomain( 'wcepe', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
20+
}
21+
1622
private function store_api_info() {
1723
if ( ! class_exists( "WC_API_Client" ) ) {
1824
require_once 'class-wc-api-client.php';

woocommerce-external-product-embed.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* Copyright: (c) 2015 Caleb Burks
1010
* License: GPL v3 or later
1111
* License URI: http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
12+
* Text Domain: wcepe
13+
* Domain Path: /languages/
1214
*/
1315
if ( ! defined( 'ABSPATH' ) ) {
1416
exit; // Exit if accessed directly
@@ -20,7 +22,7 @@ function wcepe_load_after_plugins_loaded() {
2022
if ( ! class_exists( "Woocommerce_External_Product_Embed" ) ) {
2123

2224
require_once( 'classes/class-woocommerce-external-product-embed.php' );
23-
25+
2426
if ( ! is_admin() ) {
2527
wp_register_style( 'wcepe_styles', plugins_url('assets/styles.css', __FILE__) );
2628
}

0 commit comments

Comments
 (0)