Skip to content

Commit

Permalink
fix: translate strings on various pages
Browse files Browse the repository at this point in the history
  • Loading branch information
sapayth committed Sep 9, 2024
1 parent f109638 commit c761639
Show file tree
Hide file tree
Showing 9 changed files with 1,198 additions and 529 deletions.
2 changes: 1 addition & 1 deletion Lib/WeDevs_Settings_API.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ function get_option( $option, $section, $default = '' ) {
function show_navigation() {
$html = '<h2 class="nav-tab-wrapper">';
$html .= '<div id="wpuf-search-section">
<input type="text" id="wpuf-settings-search" placeholder="Search in settings">
<input type="text" id="wpuf-settings-search" placeholder="'. esc_attr__( 'Search in settings', 'wp-user-frontend' ) .'">
<span class="dashicons dashicons-no-alt"></span>
</div>';
$count = count( $this->settings_sections );
Expand Down
3 changes: 1 addition & 2 deletions admin/html/form-settings-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@
'selected' => $default_category,
'taxonomy' => $tax->name,
];

$tax = '<tr class="wpuf_settings_taxonomy"> <th> Default '. $post_type_selected . ' '. $tax->name .'</th> <td>
$tax = '<tr class="wpuf_settings_taxonomy"> <th>' . __( 'Default ', 'wp-user-frontend' ) . $post_type_selected . ' '. $tax->name .'</th> <td>
<select multiple name="wpuf_settings[default_'.$tax->name.'][]">';
$categories = get_terms( $args );

Expand Down
16 changes: 15 additions & 1 deletion includes/Admin/Admin_Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,21 @@ public function subs_meta_box() {
<th><?php esc_html_e( 'Expiration Message', 'wp-user-frontend' ); ?></th>
<td>
<textarea name="post_expiration_settings[post_expiration_message]" id="wpuf-post_expiration_message" cols="50" rows="5"><?php echo esc_attr( $post_expiration_message ); ?></textarea>
<p class="description"><strong><?php echo esc_html( __( 'You may use: {post_author} {post_url} {blogname} {post_title} {post_status}', 'wp-user-frontend' ) ); ?></strong></p>
<p class="description">
<strong>
<?php
printf(
// translators: %1$s: {post_author}, %2$s: {post_url}, %3$s: {blogname}, %4$s: {post_title}, %5$s: {post_status}
__( 'You may use: %1$s %2$s %3$s %4$s %5$s', 'wp-user-frontend' ),
'{post_author}',
'{post_url}',
'{blogname}',
'{post_title}',
'{post_status}'
)
?>
</strong>
</p>
</td>
</tr>

Expand Down
368 changes: 254 additions & 114 deletions includes/Admin/views/support.php

Large diffs are not rendered by default.

39 changes: 24 additions & 15 deletions includes/Ajax/Admin_Form_Builder_Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class Admin_Form_Builder_Ajax {
* @return void
*/
public function save_form() {
$post_data = wp_unslash($_POST);
$post_data = wp_unslash( $_POST );
if ( isset( $post_data['form_data'] ) ) {
parse_str( $post_data['form_data'], $form_data );
parse_str( $post_data['form_data'], $form_data );
} else {
wp_send_json_error( __( 'form data is missing', 'wp-user-frontend'));
wp_send_json_error( __( 'form data is missing', 'wp-user-frontend' ) );
}

if ( !wp_verify_nonce( $form_data['wpuf_form_builder_nonce'], 'wpuf_form_builder_save_form' ) ) {
if ( ! wp_verify_nonce( $form_data['wpuf_form_builder_nonce'], 'wpuf_form_builder_save_form' ) ) {
wp_send_json_error( __( 'Unauthorized operation', 'wp-user-frontend' ) );
}

Expand All @@ -50,7 +50,6 @@ public function save_form() {
$integrations = (array) json_decode( $post_data['integrations'] );
}


$form_fields = json_decode( $form_fields, true );
$notifications = json_decode( $notifications, true );

Expand All @@ -66,15 +65,20 @@ public function save_form() {

$form_fields = Admin_Form_Builder::save_form( $data );

wp_send_json_success( [ 'form_fields' => $form_fields, 'form_settings' => $settings ] );
wp_send_json_success(
[
'form_fields' => $form_fields,
'form_settings' => $settings,
]
);
}

public function wpuf_get_post_taxonomies() {
$post_data = wp_unslash($_POST);
$post_data = wp_unslash( $_POST );
$post_type = $post_data['post_type'];
$nonce = $post_data['wpuf_form_builder_setting_nonce'];

if ( isset( $nonce ) && !wp_verify_nonce( $post_data['wpuf_form_builder_setting_nonce'], 'form-builder-setting-nonce' ) ) {
if ( isset( $nonce ) && ! wp_verify_nonce( $post_data['wpuf_form_builder_setting_nonce'], 'form-builder-setting-nonce' ) ) {
wp_send_json_error( __( 'Unauthorized operation', 'wp-user-frontend' ) );
}

Expand All @@ -91,23 +95,28 @@ public function wpuf_get_post_taxonomies() {
foreach ( $post_taxonomies as $tax ) {
if ( $tax->hierarchical ) {
$args = [
'hide_empty' => false,
'hierarchical' => true,
'taxonomy' => $tax->name,
'hide_empty' => false,
'hierarchical' => true,
'taxonomy' => $tax->name,
];

$cat .= '<tr class="wpuf_settings_taxonomy"> <th> Default '. $post_type . ' '. $tax->name .'</th> <td>
<select multiple name="wpuf_settings[default_'.$tax->name.'][]">';
$cat .= '<tr class="wpuf_settings_taxonomy"> <th>' . __( 'Default ', 'wp-user-frontend' ) . $post_type . ' ' . $tax->name . '</th> <td>
<select multiple name="wpuf_settings[default_' . $tax->name . '][]">';
$categories = get_terms( $args );

foreach ( $categories as $category ) {
$cat .= '<option value="' . $category->term_id . '">' . $category->name . '</option>';
}

$cat .='</select></td>';
$cat .= '</select></td>';
}
}

wp_send_json_success( [ 'success' => 'true' , 'data' => $cat ] );
wp_send_json_success(
[
'success' => 'true',
'data' => $cat,
]
);
}
}
45 changes: 33 additions & 12 deletions includes/Free/Form_Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace WeDevs\Wpuf\Free;

// @codingStandardsIgnoreStart
use WeDevs\Wpuf\Pro\Admin\FormBuilder\Template_Profile;

class Form_Element extends Pro_Prompt {
// @codingStandardsIgnoreEnd

public static function add_form_custom_buttons() {
$title = esc_attr( __( 'Click to add to the editor', 'wp-user-frontend' ) ); ?>
Expand Down Expand Up @@ -65,7 +63,16 @@ public static function render_form_expiration_tab() {
<?php esc_html_e( 'Enable Post Expiration', 'wp-user-frontend' ); ?>
</label>
</td>
<p class="description"><a target="_blank" href="https://wedevs.com/docs/wp-user-frontend-pro/posting-forms/using-post-expiration-wp-user-frontend/"><?php esc_html_e( 'Learn more about Automatic Post Expiration', 'wp-user-frontend' ); ?></a></p>
<p class="description">
<a target="_blank"
href="https://wedevs.com/docs/wp-user-frontend-pro/posting-forms/using-post-expiration-wp-user-frontend/">
<?php
esc_html_e(
'Learn more about Automatic Post Expiration', 'wp-user-frontend'
);
?>
</a>
</p>
</tr>
<tr class="wpuf_expiration_field">
<th><?php esc_html_e( 'Post Expiration Time', 'wp-user-frontend' ); ?></th>
Expand Down Expand Up @@ -99,9 +106,7 @@ public static function render_form_expiration_tab() {
</tr>

<tr class="wpuf_expiration_field">
<th>
Post Status :
</th>
<th><?php esc_html_e( 'Post Status', 'wp-user-frontend' ); ?></th>
<td>
<?php $post_statuses = get_post_statuses(); ?>
<select disabled name="" id="wpuf-expired_post_status">
Expand All @@ -124,9 +129,7 @@ public static function render_form_expiration_tab() {
</td>
</tr>
<tr class="wpuf_expiration_field">
<th>
Send Mail :
</th>
<th><?php esc_html_e( 'Send Mail', 'wp-user-frontend' ); ?></th>
<td>
<label>
<input disabled type="checkbox" name="" value="on" <?php echo esc_attr( $is_enable_mail_after_expired ); ?> />
Expand All @@ -135,10 +138,24 @@ public static function render_form_expiration_tab() {
</td>
</tr>
<tr class="wpuf_expiration_field">
<th>Post Expiration Message</th>
<th><?php esc_html_e( 'Post Expiration Message', 'wp-user-frontend' ); ?></th>
<td>
<textarea disabled name="" id="wpuf-post_expiration_message" cols="50" rows="5"><?php echo esc_html( $post_expiration_message ); ?></textarea>
<p class="description"><strong><?php echo esc_html( __( 'You may use: {post_author} {post_url} {blogname} {post_title} {post_status}', 'wp-user-frontend' ) ); ?></strong></p>
<p class="description">
<strong>
<?php
printf(
// translators: %1$s: {post_author}, %2$s: {post_url}, %3$s: {blogname}, %4$s: {post_title}, %5$s: {post_status}

Check warning on line 148 in includes/Free/Form_Element.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

This comment is 54% valid code; is this commented out code?
__( 'You may use: %1$s %2$s %3$s %4$s %5$s', 'wp-user-frontend' ),
'{post_author}',
'{post_url}',
'{blogname}',
'{post_title}',
'{post_status}'
)
?>
</strong>
</p>
</td>
</tr>
</table>
Expand Down Expand Up @@ -227,7 +244,11 @@ public static function add_post_notification_content() {
<?php esc_html_e( 'Enable post notification', 'wp-user-frontend' ); ?>
</label>
</td>
<p class="description"><a target="_blank" href="https://wedevs.com/docs/wp-user-frontend-pro/posting-forms/how-to-set-up-submission-email-notification/"><?php esc_html_e( 'Learn more about Email Notification', 'wp-user-frontend' ); ?></a></p>
<p class="description">
<a target="_blank" href="https://wedevs.com/docs/wp-user-frontend-pro/posting-forms/how-to-set-up-submission-email-notification/">
<?php esc_html_e( 'Learn more about Email Notification', 'wp-user-frontend' ); ?>
</a>
</p>
</tr>

<tr>
Expand Down
7 changes: 5 additions & 2 deletions includes/Free/Free_Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,11 @@ public function pro_settings( $settings_fields ) {
'name' => 'ipstack_key',
'label' => __( 'Ipstack API Key',
'wp-user-frontend' ) . '<span class="pro-icon"> ' . file_get_contents( $crown_icon_path ) . '</span>',
'desc' => __( '<a target="_blank" href="https://ipstack.com/dashboard">Register here</a> to get your Free ipstack api key',
'wp-user-frontend' ),
'desc' => sprintf(
// translators: %1$s: opening anchor tag, %2$s: closing anchor tag
__( '%1$sRegister here%2$s to get your free ipstack api key', 'wp-user-frontend' ),
'<a target="_blank" href="https://ipstack.com/dashboard">', '</a>'
),
'class' => 'pro-preview',
'is_pro_preview' => true,
];
Expand Down
11 changes: 9 additions & 2 deletions includes/functions/settings-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,15 @@ function wpuf_settings_fields() {
[
'name' => 'wpuf_compatibility_acf',
'label' => __( 'ACF Compatibility', 'wp-user-frontend' ),
'desc' => __( 'Select <strong>Yes</strong> if you want to make compatible WPUF custom fields data with advanced custom fields.',
'wp-user-frontend' ),
'desc' => sprintf(
// translators: %1$s and %2$s are strong tags
__(
'Select %1$sYes%2$s if you want to make compatible WPUF custom fields data with advanced custom fields.',
'wp-user-frontend'
),
'<strong>',
'</strong>'
),
'type' => 'select',
'default' => 'no',
'options' => [
Expand Down
Loading

0 comments on commit c761639

Please sign in to comment.