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

fix: translate strings on various pages #1478

Merged
merged 4 commits into from
Sep 17, 2024

Conversation

sapayth
Copy link
Member

@sapayth sapayth commented Sep 9, 2024

fixes #565

Issue:
Some strings are not getting translated properly.

Summary by CodeRabbit

  • New Features

    • Improved localization for various user-facing texts, enhancing accessibility for non-English speakers.
    • Dynamic placeholders for descriptions and messages, allowing for better internationalization.
  • Bug Fixes

    • Enhanced formatting of expiration messages for clarity and readability.
  • Documentation

    • Updated localization strings for better clarity and consistency in user instructions.
  • Chores

    • Minor cosmetic adjustments to improve code readability without affecting functionality.

Copy link

coderabbitai bot commented Sep 9, 2024

Walkthrough

The pull request introduces various modifications across multiple files, primarily focusing on enhancing internationalization and localization support. Changes include updating static strings to use translation functions, improving the formatting of messages, and refining HTML output for better readability. These updates aim to ensure that user-facing text is translatable and accessible to a broader audience, while also maintaining code clarity and structure.

Changes

File Change Summary
Lib/WeDevs_Settings_API.php Updated placeholder text for wpuf-settings-search input to use esc_attr__() for localization.
admin/html/form-settings-post.php Wrapped static text "Default %s %s" in __() for localization.
includes/Admin/Admin_Subscription.php Modified expiration message display using printf for better localization and clarity.
includes/Admin/views/support.php Replaced static strings with __() and esc_html_e() for translation; improved structure with printf() for dynamic content.
includes/Ajax/Admin_Form_Builder_Ajax.php Adjusted formatting for readability; no functional changes.
includes/Free/Form_Element.php Enhanced HTML output formatting; replaced inline text with localized strings using esc_html_e().
includes/Free/Free_Loader.php Replaced static description string with sprintf for dynamic content and improved localization.
includes/Traits/TaxableTrait.php Updated localization functions for security and changed text domain for tax-related UI elements.
wpuf.php Changed text domain in wpuf_upgrade_notice function for localization consistency.

Assessment against linked issues

Objective Addressed Explanation
Frontend JS error fix (#565) Changes do not address JS initialization issues.

🐰 In the land of code where changes bloom,
Localization spreads, dispelling the gloom.
With strings now wrapped in a translatable way,
Our plugin shines bright, come what may!
So hop along, dear users, and see,
The magic of updates, as fresh as can be! 🌼✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f109638 and c761639.

Files selected for processing (9)
  • Lib/WeDevs_Settings_API.php (1 hunks)
  • admin/html/form-settings-post.php (1 hunks)
  • includes/Admin/Admin_Subscription.php (1 hunks)
  • includes/Admin/views/support.php (5 hunks)
  • includes/Ajax/Admin_Form_Builder_Ajax.php (4 hunks)
  • includes/Free/Form_Element.php (6 hunks)
  • includes/Free/Free_Loader.php (1 hunks)
  • includes/functions/settings-options.php (1 hunks)
  • languages/wp-user-frontend.pot (45 hunks)
Files skipped from review due to trivial changes (2)
  • includes/Ajax/Admin_Form_Builder_Ajax.php
  • includes/functions/settings-options.php
Additional comments not posted (68)
includes/Free/Form_Element.php (4)

66-75: Translation function correctly implemented in link.

The use of esc_html_e() within the anchor tag is correctly implemented for translating the link text. The HTML structure is properly maintained.


109-109: Proper use of translation function for static label.

The translation function esc_html_e() is correctly used for the "Post Status" label, ensuring it is properly translated and escaped.


141-158: Dynamic content correctly handled with printf() for translation.

The implementation of printf() within the description is correctly used to format the message with placeholders, allowing for full translation of the sentence. This is a good practice for handling dynamic content in translatable strings.


247-251: Translation function correctly implemented in link.

The use of esc_html_e() within the anchor tag is correctly implemented for translating the link text. The HTML structure is properly maintained.

Lib/WeDevs_Settings_API.php (1)

541-541: Proper use of translation function for placeholder text.

The translation function esc_attr__() is correctly used for the placeholder text "Search in settings", ensuring it is properly translated and escaped.

includes/Admin/views/support.php (17)

7-19: Translation functions correctly implemented.

The use of __() for translating static strings is appropriate and correctly uses the 'wp-user-frontend' text domain. This ensures that the plugin's text can be translated into different languages, enhancing accessibility and usability.


25-45: Consistent use of translation functions.

The titles within the 'posting' section are correctly internationalized using the __() function with the appropriate text domain. This consistency is crucial for maintaining a uniform user experience across different languages.


51-59: Proper implementation of internationalization.

The 'dashboard' section titles are correctly internationalized using the __() function. This consistent application of translation functions across different sections ensures that all user-facing text is accessible in multiple languages.


65-77: Correct use of translation functions in settings section.

The titles in the 'settings' section are internationalized using the __() function, maintaining consistency with the rest of the file. This approach ensures that all sections of the plugin can be easily translated.


83-99: Translation functions applied consistently in registration section.

The use of __() for translating titles in the 'registration' section is consistent with other sections, ensuring that the plugin remains accessible to a global audience.


105-105: Single title correctly internationalized in profile section.

The title in the 'profile' section is appropriately translated using the __() function, aligning with the internationalization practices seen throughout the document.


111-131: Consistent internationalization in subscription section.

Titles in the 'subscription' section are internationalized using the __() function. This consistency is key to ensuring the plugin is fully translatable and accessible.


138-158: Developer section titles properly internationalized.

The 'developer' section titles are translated using the __() function, maintaining the uniform application of internationalization techniques across the plugin.


164-172: Restriction section titles internationalized correctly.

The titles in the 'restriction' section are internationalized using the __() function, ensuring that all parts of the plugin can be translated into different languages.


315-395: Dynamic content and translation functions correctly implemented in Plugin Setup Guide.

The use of printf() combined with esc_html__() for dynamic content ensures secure output while maintaining the ability to translate complex sentences. The inclusion of HTML tags within the translation strings is handled correctly, preserving the intended formatting.


403-423: Frontend Posting section correctly uses dynamic content and translation functions.

Similar to the 'Plugin Setup Guide', the 'Frontend Posting' section uses printf() with translation functions to handle dynamic content securely and effectively. This ensures that the content can be translated while maintaining the correct formatting.


430-453: Frontend Dashboard section effectively uses translation functions and dynamic content.

The 'Frontend Dashboard' section correctly uses printf() with translation functions to handle dynamic content, ensuring that the content remains secure and translatable. This consistency in handling dynamic content is crucial for maintaining a uniform user experience.


460-472: User Registration section correctly uses translation functions and dynamic content.

The 'User Registration' section uses printf() with translation functions to handle dynamic content, ensuring that the content is secure and translatable. This approach is consistent with other sections, maintaining uniformity across the plugin.


499-519: Login Page section effectively uses translation functions and dynamic content.

The 'Login Page' section uses printf() with translation functions to handle dynamic content, ensuring that the content is secure and translatable. This consistency in handling dynamic content is crucial for maintaining a uniform user experience.


524-541: Profile Editing Form section correctly uses translation functions and dynamic content.

The 'Creating a Profile Editing Form' section uses printf() with translation functions to handle dynamic content, ensuring that the content is secure and translatable. This approach is consistent with other sections, maintaining uniformity across the plugin.


560-603: Subscription Payment section effectively uses translation functions and dynamic content.

The 'Subscription Payment' section uses printf() with translation functions to handle dynamic content, ensuring that the content is secure and translatable. This consistency in handling dynamic content is crucial for maintaining a uniform user experience.


611-611: Content Restriction section titles internationalized correctly.

The title in the 'Content Restriction' section is internationalized using the __() function, ensuring that all parts of the plugin can be translated into different languages.

includes/Admin/Admin_Subscription.php (1)

490-504: Improved message formatting in subs_meta_box.

The use of printf to format the expiration message in the subs_meta_box function enhances readability and localization. The placeholders are well-documented, which will help in maintaining and updating the code in the future.

includes/Free/Free_Loader.php (1)

236-240: Enhanced Localization with Dynamic String Construction

The modification in the desc field of the pro_settings method from a static string to a dynamic string using sprintf is a significant improvement. This change allows for better localization by enabling the translation of the text within the anchor tags. The use of placeholders %1$s and %2$s for the anchor tags is correctly implemented, ensuring that the HTML structure can be dynamically altered without affecting the translatable text.

This approach adheres to best practices for internationalization in WordPress, making the text accessible to a broader audience by facilitating easier translations.

languages/wp-user-frontend.pot (44)

7-7: Updated POT-Creation-Date.

The POT-Creation-Date has been updated to reflect the most recent timestamp. This change is necessary to indicate the latest update time for the localization file.


35-35: Updated msgid for clarity.

The msgid "After payment users will be redirected here" has been updated to include a reference to the file includes/functions/settings-options.php:525, suggesting that the string is used in multiple locations. This is a good practice for maintainability and ensuring that translations are consistent across different parts of the application.


92-95: Added new msgid for search functionality.

A new msgid "Search in settings" has been added to the localization file. This is a positive change as it likely supports new functionality in the plugin that allows users to search within settings. Ensuring that new user-facing strings are translatable is crucial for maintaining a good user experience in multilingual setups.


449-449: Updated msgid for clarity in payment settings.

The msgid "Pay Per Post" has been updated in the context of payment settings, as indicated by the reference to includes/Admin/views/support.php:589. This change is part of the broader effort to enhance clarity and user understanding in payment-related functionalities.


474-474: Updated msgid for payment success page.

The msgid "Payment Success Page" has been updated, which is used in the context of payment settings (includes/functions/settings-options.php:524). This update is likely to improve the clarity of the payment process for users.


500-500: Updated msgid for redirection settings.

The msgid "Redirect To" has been updated, which is used in the context of post settings (includes/Free/Form_Element.php:416). This change helps clarify the action that occurs after a form submission, improving user understanding of the form behavior.


505-505: Updated msgid for new post context.

The msgid "Newly created post" has been updated, which is used in the context of post creation settings (includes/Free/Form_Element.php:421). This update likely aims to provide clearer information to users about the status of a post after it is created.


510-510: Updated msgid for same page redirection.

The msgid "Same Page" has been updated, which is used in the context of redirection settings (includes/Free/Form_Element.php:422). This change ensures that users have clear options when configuring redirection behaviors in forms.


515-515: Updated msgid for custom URL redirection.

The msgid "To a page" has been updated to "To a custom URL", which is used in the context of redirection settings (includes/Free/Form_Element.php:423). This change clarifies that users can redirect to a custom URL, enhancing flexibility in form configurations.


520-520: Updated msgid for redirection target description.

The msgid "After successfull submit, where the page will redirect to" has been updated, which is used in the context of form settings (includes/Free/Form_Element.php:432). This update improves the description for redirection targets, aiding users in making informed decisions about form behavior.


534-534: Updated msgid for page context.

The msgid "Page" has been updated, which is used in the context of page settings (includes/Free/Form_Element.php:452). This change likely aims to provide clearer context about the type of content users are working with.


539-539: Updated msgid for custom URL context.

The msgid "Custom URL" has been updated, which is used in the context of URL settings (includes/Free/Form_Element.php:475). This update clarifies the type of URL that users can configure, enhancing usability.


611-615: Updated msgid for default post settings.

The msgid "Default " has been updated to include a trailing space, which is used in the context of default settings (includes/Ajax/Admin_Form_Builder_Ajax.php:103). This change ensures consistency in the presentation of default options in the user interface.


747-747: Updated msgid for unauthorized message.

The msgid "Unauthorized Message" has been updated, which is used in the context of authorization settings (includes/functions/settings-options.php:310). This update likely aims to provide clearer feedback to users about authorization states.


778-778: Updated msgid for date range end.

The msgid "To" has been updated, which is used in the context of date range settings (includes/Free/Form_Element.php:255, includes/Free/Form_Element.php:292). This change clarifies the end point of a date range, aiding users in setting up date-based filters or conditions.


1554-1554: Updated msgid for subscription cancellation.

The msgid "Cancel" has been updated, which is used in the context of subscription management (includes/Admin/Admin_Subscription.php:826, includes/Admin/Forms/Admin_Form_Builder.php:292, includes/Admin/List_Table_Subscribers.php:144, includes/Admin/Subscription.php:873, includes/Frontend/Payment.php:246, templates/dashboard/subscription.php:68). This update likely aims to provide a clearer action label for users wishing to cancel subscriptions.


1616-1616: Updated msgid for free subscription context.

The msgid "Free" has been updated, which is used in the context of subscription settings (includes/Admin/Admin_Subscription.php:621, includes/Admin/Subscription.php:973, includes/Free/templates/page-registration-form.php:94, includes/Frontend/Frontend_Account.php:227, includes/User_Subscription.php:314, templates/subscriptions/pack-details.php:24). This change ensures that the term "Free" is consistently used across different parts of the application related to subscriptions.


1692-1692: Updated msgid for payment settings context.

The msgid "Payment Settings" has been updated, which is used in the context of payment configuration (includes/Admin/Forms/Admin_Form.php:243, includes/Admin/views/support.php:77). This update likely aims to provide a clearer label for settings related to payment processing.


1713-1713: Updated msgid for featured item count.

The msgid "Number of featured item" has been updated, which is used in the context of item count settings (includes/Admin/Admin_Subscription.php:672). This change clarifies the label for settings that determine the number of items that can be featured.


1730-1730: Updated msgid for post expiration settings.

The msgid "Post Expiration" has been updated, which is used in the context of post settings (includes/Admin/Forms/Admin_Form.php:247, includes/Free/Form_Element.php:59). This update clarifies the label for settings related to the expiration of posts.


1734-1734: Updated msgid for enabling post expiration.

The msgid "Enable Post Expiration" has been updated, which is used in the context of post expiration settings (includes/Admin/Admin_Subscription.php:426, includes/Free/Form_Element.php:63). This change ensures that the option to enable post expiration is clearly labeled, aiding users in configuring post lifecycle management.


1739-1739: Updated msgid for post expiration time.

The msgid "Post Expiration Time" has been updated, which is used in the context of setting the duration after which posts expire (includes/Admin/Admin_Subscription.php:729, includes/Free/Form_Element.php:78). This update clarifies the label for the setting that specifies the time frame for post expiration.


1743-1743: Updated msgid for post status after expiration.

The msgid "Status of post after post expiration time is over " has been updated, which is used in the context of post status settings after expiration (includes/Admin/Admin_Subscription.php:468, includes/Free/Form_Element.php:127). This change clarifies the label for settings that determine the status of posts after they have expired.


1763-1766: Updated msgid for expiration message placeholders.

The msgid "You may use: %1$s %2$s %3$s %4$s %5$s" has been updated, which is used in the context of providing placeholders for custom messages related to expiration (includes/Admin/Admin_Subscription.php:495, includes/Free/Form_Element.php:149). This update ensures that users are aware of the placeholders they can use in custom messages.


1769-1769: Updated msgid for time units.

The msgid "Day(s)" has been updated, which is used in the context of specifying time units (includes/Admin/Admin_Subscription.php:566). This change clarifies the label for settings that involve specifying durations in days.


1773-1773: Updated msgid for week time unit.

The msgid "Week(s)" has been updated, which is used in the context of specifying time units (includes/Admin/Admin_Subscription.php:567). This change clarifies the label for settings that involve specifying durations in weeks.


1777-1777: Updated msgid for month time unit.

The msgid "Month(s)" has been updated, which is used in the context of specifying time units (includes/Admin/Admin_Subscription.php:568). This change clarifies the label for settings that involve specifying durations in months.


1781-1781: Updated msgid for year time unit.

The msgid "Year(s)" has been updated, which is used in the context of specifying time units (includes/Admin/Admin_Subscription.php:569). This change clarifies the label for settings that involve specifying durations in years.


1785-1785: Updated msgid for subscription information.

The msgid "WPUF Subscription Information" has been updated, which is used in the context of displaying subscription information (includes/Admin/Admin_Subscription.php:613). This change ensures that the label for displaying subscription information is clear and informative.


1789-1789: Updated msgid for billing cycle.

The msgid "For each %1$s %2$s" has been updated, which is used in the context of specifying billing cycles (includes/Admin/Admin_Subscription.php:625, includes/Frontend/Frontend_Account.php:237). This change clarifies the label for settings that determine the frequency of billing cycles.


1793-1793: Updated msgid for installment settings.

The msgid ", for %s installments" has been updated, which is used in the context of specifying the number of installments for payments (includes/Admin/Admin_Subscription.php:626, includes/Frontend/Frontend_Account.php:237). This change clarifies the label for settings that determine the number of payment installments.


1799-1799: Updated msgid for subscription name.

The msgid "Subcription Name" has been updated, which is used in the context of specifying the name of a subscription (includes/Admin/Admin_Subscription.php:637). This change ensures that the label for the subscription name setting is clear and descriptive.


1803-1803: Updated msgid for billing information.

The msgid "Billing Info" has been updated, which is used in the context of displaying billing information (includes/Admin/Admin_Subscription.php:647). This change clarifies the label for the section where billing information is displayed.


1807-1807: Updated msgid for recurring subscription context.

The msgid "This user is using recurring subscription pack" has been updated, which is used in the context of user subscription status (includes/Admin/Admin_Subscription.php:661). This change clarifies the label for indicating whether a user is using a recurring subscription pack.


1811-1811: Updated msgid for posting count.

The msgid "Remaining Posting Count" has been updated, which is used in the context of subscription limits (includes/Admin/Admin_Subscription.php:667). This change clarifies the label for the setting that displays the remaining number of posts a user can make under a subscription.


1815-1815: Updated msgid for subscription expiration information.

The msgid "Subscription Expiration Info" has been updated, which is used in the context of displaying subscription expiration details (includes/Admin/Admin_Subscription.php:696). This change ensures that the label for the section displaying subscription expiration information is clear and informative.


1819-1819: Updated msgid for expiration date.

The msgid "Expire date:" has been updated, which is used in the context of displaying the expiration date of a subscription (includes/Admin/Admin_Subscription.php:705, includes/User_Subscription.php:366, templates/dashboard/subscription.php:50). This change clarifies the label for the expiration date, making it easier for users to understand when their subscription will expire.


1824-1824: Updated msgid for post expiration settings.

The msgid "Post Expiration Enabled" has been updated, which is used in the context of post expiration settings (includes/Admin/Admin_Subscription.php:718). This change clarifies the label for the setting that enables or disables post expiration.


1828-1828: Updated msgid for allowed taxonomy terms.

The msgid "Allowed Taxonomy Terms" has been updated, which is used in the context of taxonomy term settings (includes/Admin/Admin_Subscription.php:755). This change clarifies the label for the setting that specifies which taxonomy terms are allowed under a subscription.


1832-1832: Updated msgid for package assignment.

The msgid "Assign Package" has been updated, which is used in the context of subscription package assignment (includes/Admin/Admin_Subscription.php:825). This change clarifies the label for the action of assigning a subscription package to a user.


1836-1836: Updated msgid for package selection.

The msgid "Select Package:" has been updated, which is used in the context of selecting a subscription package (includes/Admin/Admin_Subscription.php:832). This change clarifies the label for the dropdown or selection interface where users can choose a subscription package.


1840-1841: Updated msgid for non-recurring package note.

The msgid "— Select —" has been updated to include a note about non-recurring packages, which is used in the context of package selection (includes/Admin/Admin_Subscription.php:835, includes/functions/settings-options.php:639, wpuf-functions.php:215, wpuf-functions.php:1838, wpuf-functions.php:2103). This change clarifies that only non-recurring packs can be assigned, which is an important distinction for users managing subscriptions.


1846-1846: Updated msgid for package deletion.

The msgid "Delete Package" has been updated, which is used in the context of subscription package management (includes/Admin/Admin_Subscription.php:850). This change clarifies the label for the action of deleting a subscription package.


1850-1850: Updated msgid for subscription learning resource.

The msgid "Learn more about <a href="%s" target="_blank">Subscription" has been updated, which is used in the context of providing a learning resource for subscriptions (includes/Admin/Admin_Subscription.php:909). This change ensures that the label for the link to subscription-related information is clear and actionable.

@@ -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>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using sprintf() for dynamic string translation.

The current implementation concatenates translated text with variables, which might not translate well in languages where the order of words is different. Consider using sprintf() to allow translators to control the placement of the variables within the translated string:

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

includes/Free/Form_Element.php Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c761639 and 88e7529.

Files selected for processing (3)
  • admin/html/form-settings-post.php (1 hunks)
  • includes/Admin/views/support.php (4 hunks)
  • includes/Free/Form_Element.php (5 hunks)
Files skipped from review as they are similar to previous changes (1)
  • admin/html/form-settings-post.php
Additional context used
GitHub Check: Run PHPCS inspection
includes/Free/Form_Element.php

[warning] 148-148:
This comment is 54% valid code; is this commented out code?

Additional comments not posted (13)
includes/Free/Form_Element.php (4)

66-75: LGTM!

The changes to the comment are approved. Using esc_html_e() for the text improves translatability and splitting the link URL across multiple lines enhances code readability.


109-109: LGTM!

The change to use esc_html_e() for the "Post Status" label text is approved. It correctly makes the text translatable.


132-136: LGTM!

The changes to use esc_html_e() for the "Send Mail" label and the checkbox label are approved. They correctly make the texts translatable.


141-158: LGTM!

The changes to the "Post Expiration Message" section are approved:

  • Using esc_html_e() for the label text correctly makes it translatable.
  • Using printf() with placeholders and __() for the description text correctly makes it translatable while allowing for dynamic content.
  • The changes improve the translatability and formatting of the description text.
Tools
GitHub Check: Run PHPCS inspection

[warning] 148-148:
This comment is 54% valid code; is this commented out code?

includes/Admin/views/support.php (9)

315-317: LGTM!

The changes to use esc_html_e() for the "Plugin Setup Guide" heading and the paragraph text are approved. They correctly make the texts translatable.


320-332: LGTM!

The changes to the list item text are approved:

  • Using printf() with placeholders and __() correctly makes the text translatable while allowing for dynamic content.
  • The changes improve the translatability and formatting of the list item text.

333-348: LGTM!

The changes to the list item texts are approved:

  • Using esc_html_e() for the first list item text correctly makes it translatable.
  • Using printf() with placeholders and __() for the second list item text correctly makes it translatable while allowing for dynamic content.
  • The changes improve the translatability and formatting of the list item texts.

349-361: LGTM!

The changes to the list item text and link are approved:

  • Using printf() with placeholders and __() for the list item text correctly makes it translatable while allowing for dynamic content.
  • Using esc_url() and admin_url() for the link URL correctly generates the URL dynamically and escapes it for security.
  • The changes improve the translatability, formatting, and security of the list item text and link.

362-371: LGTM!

The changes to the list item text are approved:

  • Using printf() with placeholders and __() correctly makes the text translatable while allowing for dynamic content.
  • The changes improve the translatability and formatting of the list item text.

372-384: LGTM!

The changes to the list item text are approved:

  • Using printf() with placeholders and __() correctly makes the text translatable while allowing for dynamic content.
  • The changes improve the translatability and formatting of the list item text.

385-395: LGTM!

The changes to the list item text are approved:

  • Using printf() with placeholders and __() correctly makes the text translatable while allowing for dynamic content.
  • The changes improve the translatability and formatting of the list item text.

403-423: LGTM!

The changes to the "Frontend Posting" section are approved:

  • Using esc_html_e() for the heading text correctly makes it translatable.
  • Using printf() with placeholders and __() for the paragraph texts correctly makes them translatable while allowing for dynamic content.
  • Using esc_url() and admin_url() for the link URL correctly generates the URL dynamically and escapes it for security.
  • The changes improve the translatability, formatting, and security of the heading, paragraphs, and link.

430-453: LGTM!

The changes to the "Frontend Dashboard" section are approved:

  • Using esc_html_e() for the heading text correctly makes it translatable.
  • Using printf() with placeholders and __() for the paragraph texts correctly makes them translatable while allowing for dynamic content.
  • Using esc_url() and admin_url() for the link URL correctly generates the URL dynamically and escapes it for security.
  • The changes improve the translatability, formatting, and security of the heading, paragraphs, and link.

@Rubaiyat-E-Mohammad
Copy link

One is not fixed from the sheet.

Steps: Settings >> Tax Settings >> Please refer to the Screenshots to check the unaffected strings

Screenshot: link

@Rubaiyat-E-Mohammad Rubaiyat-E-Mohammad added bug needs: developer feedback This PR needs developer feedback or code changes and removed needs: testing labels Sep 13, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
wpuf.php (1)

244-244: Suggestion: Use printf(...) instead of echo sprintf(...).

The text domain has been correctly updated to 'wp-user-frontend' for proper localization.

However, as suggested by the static analysis hint, it's more concise to use printf(...) directly instead of echo sprintf(...).

Apply this diff to simplify the code:

-echo sprintf( __( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>WP User Frontend Pro</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ), '<a target="_blank" href="https://wordpress.org/plugins/wp-user-frontend/">', '</a>' );
+printf( __( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>WP User Frontend Pro</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ), '<a target="_blank" href="https://wordpress.org/plugins/wp-user-frontend/">', '</a>' );
Tools
GitHub Check: Run PHPCS inspection

[failure] 244-244:
Unnecessary "echo sprintf(...)" found. Use "printf(...)" instead.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ae4ddcc and b1756c1.

Files selected for processing (3)
  • includes/Free/Free_Loader.php (3 hunks)
  • includes/Traits/TaxableTrait.php (12 hunks)
  • wpuf.php (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • includes/Free/Free_Loader.php
Additional context used
GitHub Check: Run PHPCS inspection
wpuf.php

[failure] 244-244:
Unnecessary "echo sprintf(...)" found. Use "printf(...)" instead.

Additional comments not posted (8)
wpuf.php (1)

240-240: LGTM!

The text domain has been correctly updated to 'wp-user-frontend' for proper localization.

includes/Traits/TaxableTrait.php (7)

81-82: LGTM!

The text domain change to 'wp-user-frontend' for the table header labels and the placeholder addition to the country dropdown are appropriate changes that improve consistency and usability.

Also applies to: 109-109


161-161: LGTM!

The placeholder addition to the state dropdown is an appropriate change that improves usability.


190-193: LGTM!

The text domain change to 'wp-user-frontend' for the table header labels and help text, as well as the placeholder additions to the country and state dropdowns, are appropriate changes that improve consistency and usability.

Also applies to: 212-212, 234-234


Line range hint 298-369: Skipped review.

This function has no changes, so no review is necessary.


Line range hint 420-432: Skipped review.

This function has no changes, so no review is necessary.


504-504: LGTM!

The text domain change to 'wp-user-frontend' for the "Tax" label is an appropriate change that improves consistency.


179-179: Verify the impact of changing the function visibility to public.

Changing the visibility of the wpuf_tax_rates function from private to public might affect how this function can be accessed from other parts of the codebase. Please ensure that this change is intended and does not introduce any undesirable side effects.

Verification successful

The visibility change appears intentional and doesn't introduce undesirable side effects.

Based on the analysis of the codebase, changing the visibility of the wpuf_tax_rates function from private to public doesn't seem to introduce any undesirable side effects. The only usage found outside the trait is in a configuration array in Free_Loader.php, which is unaffected by the visibility change.

However, to ensure the change aligns with the intended plugin architecture:

  • Double-check if making the function public is necessary for your current or future use cases.
  • Confirm that exposing this function publicly doesn't violate any encapsulation principles you're following in your project.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if the `wpuf_tax_rates` function is being accessed from outside the `TaxableTrait`.

# Test: Search for usages of the function. Expect: No usages outside the trait.
rg --type php -w 'wpuf_tax_rates' --iglob '!includes/Traits/TaxableTrait.php'

Length of output: 161


Script:

#!/bin/bash
# Description: View the context of the `wpuf_tax_rates` usage in Free_Loader.php

# Display 10 lines before and after the occurrence of 'wpuf_tax_rates'
rg --type php -C 10 "'wpuf_tax_rates'" includes/Free/Free_Loader.php

Length of output: 1316

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs: developer feedback This PR needs developer feedback or code changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants