Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: improve translation handling #434

Merged
merged 8 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ function ppom_load_pro_options() {
'ppom-enf-btn-class' => array(
'type' => 'text',
'title' => __( 'Button Class', 'woocommerce-product-addon' ),
'desc' => __( ' Add custom CSS classes to the enquiry form button, separated by commas.', 'woocommerce-product-addon' ),
'desc' => __( 'Add custom CSS classes to the enquiry form button, separated by commas.', 'woocommerce-product-addon' ),
),
'ppom-enf-btn-text-color' => array(
'type' => 'color',
Expand Down
16 changes: 14 additions & 2 deletions backend/templates/admin-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,13 @@ class="nmsf-label <?php echo ! $is_available ? 'ppom-is-locked-section' : ''; ?
<div class="nmsf-panel-settings-area <?php echo ! $is_available ? 'ppom-is-locked-panel' : ''; ?>">
<?php if ( ! $is_available ): ?>
<div class="ppom-notice-upsell"><p>
<?php echo sprintf( __( '%s customization is not available on your current plan. %sUpgrade to the Pro%s plan to unlock the ability to fully enable and customize this functionality.', 'woocommerce-product-addon' ), esc_html( $title ), sprintf( '<a href="%s" target="_blank">', esc_url( tsdk_utmify( PPOM_UPGRADE_URL, $id ) ) ), '</a>' ); ?>
<?php echo sprintf(
// translators: %1$s: the name of plugin feature, %2$s: opening anchor tag, %3$s: closing anchor tag.
__( '%1$s customization is not available on your current plan. %2$sUpgrade to the Pro%2$s plan to unlock the ability to fully enable and customize this functionality.', 'woocommerce-product-addon' ),
esc_html( $title ),
sprintf( '<a href="%s" target="_blank">', esc_url( tsdk_translate_link( tsdk_utmify( PPOM_UPGRADE_URL, $id ) ) ) ),
Soare-Robert-Daniel marked this conversation as resolved.
Show resolved Hide resolved
'</a>'
); ?>
</p>
</div>
<?php endif; ?>
Expand Down Expand Up @@ -142,7 +148,13 @@ class="<?php echo $condition_class; ?>"
<td class="nmsf-section-type" colspan="2">
<?php if ( $is_available && !$is_input_available ): ?>
<div class="ppom-notice-upsell"><p>
<?php echo sprintf( __( '%s customization is not available on your current plan. %sUpgrade to the Pro%s plan to unlock the ability to fully enable and customize this functionality.', 'woocommerce-product-addon' ), esc_html( $title ), sprintf( '<a href="%s" target="_blank">', esc_url( tsdk_utmify( PPOM_UPGRADE_URL, $id ) ) ), '</a>' ); ?>
<?php echo sprintf(
// translators: %1$s: the name of plugin feature, %2$s: opening anchor tag, %3$s: closing anchor tag.
__( '%1$s customization is not available on your current plan. %2$sUpgrade to the Pro%3$s plan to unlock the ability to fully enable and customize this functionality.', 'woocommerce-product-addon' ),
esc_html( $title ),
sprintf( '<a href="%s" target="_blank">', esc_url( tsdk_translate_link( tsdk_utmify( PPOM_UPGRADE_URL, $id ) ) ) ),
'</a>'
); ?>
Soare-Robert-Daniel marked this conversation as resolved.
Show resolved Hide resolved
</p>
</div>
<?php endif; ?>
Expand Down
25 changes: 18 additions & 7 deletions classes/admin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function add_menu_pages() {

$menu = add_submenu_page(
$page ['parent_slug'],
__( $page ['page_title'], 'woocommerce-product-addon' ),
$page ['page_title'],
__( 'PPOM Fields', 'woocommerce-product-addon' ),
$cap,
$page ['slug'],
Expand All @@ -165,7 +165,7 @@ function add_menu_pages() {
$cap = 'ppom_options_page';
// Menu page for roles set by PPOM Permission Settings
$menu = add_menu_page(
__( $page ['page_title'], 'woocommerce-product-addon' ),
$page ['page_title'],
__( 'PPOM Fields', 'woocommerce-product-addon' ),
$cap,
$page ['slug'],
Expand Down Expand Up @@ -270,7 +270,14 @@ function get_products() {
$ppom_id = intval( $_GET['ppom_id'] );
$license_status = apply_filters( 'product_ppom_license_status', '' );
$current_saved_value = $this->get_db_field( $ppom_id );
$pro_multiple_fields = ! ppom_pro_is_installed() || 'valid' !== $license_status ? '</br><i style="font-size: 90%">' . sprintf( __( 'Your current plan supports adding one group of fields per product. To add multiple groups to the same product, please %supgrade%s your plan!', 'woocommerce-product-addon' ), '<a target="_blank" href="' . tsdk_utmify( tsdk_translate_link( PPOM_UPGRADE_URL ), 'multiple-fields' ) . '">', '</a>' ) . '</i>' : '';
$pro_multiple_fields = ! ppom_pro_is_installed() || 'valid' !== $license_status
? '</br><i style="font-size: 90%">' . sprintf(
// translators: %1$s: the opening tag for upsell link, %2$s: the closing tag for upsell link.
__( 'Your current plan supports adding one group of fields per product. To add multiple groups to the same product, please %1$supgrade%2$s your plan!', 'woocommerce-product-addon' ),
'<a target="_blank" href="' . tsdk_utmify( tsdk_translate_link( PPOM_UPGRADE_URL ), 'multiple-fields' ) . '">',
'</a>'
) . '</i>'
Soare-Robert-Daniel marked this conversation as resolved.
Show resolved Hide resolved
: '';
$select_products_id_component = ( new \PPOM\Attach\SelectComponent() )
->set_id( 'attach-to-products' )
->set_title( __( 'Display on Specific Products', 'woocommerce-product-addon' ) )
Expand Down Expand Up @@ -635,7 +642,13 @@ function ppom_attach_ppoms() {
self::save_categories_and_tags( $ppom_id, $categories_to_attach, $tags_to_attach );

$response = array(
'message' => "PPOM updated for {$updated_products} Products, {$updated_cat} Categories and {$updated_tags} Tags.",
'message' => sprintf(
// translators: %1$d: number of products, %2$d: number of categories, %3$d: number of tags.
__('PPOM updated for %1$d Products, %2$d Categories and %3$d Tags.', 'woocommerce-product-addon'),
$updated_products,
$updated_cat,
$updated_tags
),
'status' => 'success',
);

Expand Down Expand Up @@ -680,10 +693,8 @@ function validate_plugin() {

echo '<div class="wrap">';
echo '<h2>' . __( 'Provide API key below:', 'woocommerce-product-addon' ) . '</h2>';
echo '<p>' . __( 'If you don\'t know your API key, please login into your: <a target="_blank" href="http://wordpresspoets.com/member-area">Member area</a>', 'woocommerce-product-addon' ) . '</p>';

echo '<form onsubmit="return validate_api_wooproduct(this)">';
echo '<p><label id="plugin_api_key">' . __( 'Entery API key', 'woocommerce-product-addon' ) . ':</label><br /><input type="text" name="plugin_api_key" id="plugin_api_key" /></p>';
echo '<p><label id="plugin_api_key">' . __( 'Enter API key', 'woocommerce-product-addon' ) . ':</label><br /><input type="text" name="plugin_api_key" id="plugin_api_key" /></p>';
wp_nonce_field();
echo '<p><input type="submit" class="button-primary button" name="plugin_api_key" /></p>';
echo '<p id="nm-sending-api"></p>';
Expand Down
2 changes: 1 addition & 1 deletion classes/attach-popup/container-view.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ContainerView {
* @return string
*/
public function render() {
return 'Empty!';
return '';
}

/**
Expand Down
Loading
Loading