• Hi,
    I wanted to raise an issue at https://github.com/the-events-calendar/event-tickets but since that’s not available, I’m reaching out here instead.
    (I’m not a good enough coder to directly make a super-duper Pull Request 🙂 )

    As I was validating some translations for this plugin, I noted the following i18n (internationalization) problems with your code:

    1. Unnecessary use of _x()
    The purpose of _x() is to allow for one and the same exact string to be translated in various ways depending on context. This is usually most relevant for quite short strings. Let’s say you’ve got two strings ‘Post’ in your plugin, where one is a button to post (as in Publish!) something, and the other is a selection between the content types Post vs. Page.
    Since gettext uses the string itself as the translation key, these strings would clash. In this case, _x() saves the situation by generating a longer (and more explanatory) translation key, by including the “context” descriptor, too.
    In event-tickets, you’ve got the string “The access token to authorize Zapier connection.” several times, since you’ve mixed in various context keys. But this string will translate exactly the same, regardless of which particular endpoint we’re hitting.
    It may still be good to add (at least somewhere, a “// translators:” comment to get a description of the parameter, or error, or whatever to make it easier for translation contributors who might not know much about REST, API, etc.
    (Another such duplicated string is ‘A required parameter is missing or an input parameter is in the wrong format’, there may be more – these are the ones I just stumbled upon.)

    2. Incorrect use of _n()
    It may feel like _n() would be a elegant way to split a string between singular and plural. But it really is not.
    You should ONLY use _n() if the steering number is included in the string itself. If you don’t include the steering number in your string, then you must not use _n(), instead just test for n==1 and serve the singular or plural string normally.
    Here’s one example from your plugin:

    Singular:
    You have a license key for %1$s but the key is out of installs. %2$sVisit the Events Calendar website%3$s to manage your installs, upgrade your license, or purchase a new one.
    Plural:
    You have license keys for %1$s but your keys are out of installs. %2$sVisit the Events Calendar website%3$s to manage your installs, upgrade your licenses, or purchase new ones.

    (Ref: https://plugins.trac.ww.wp.xz.cn/browser/event-tickets/tags/5.21.0/common/src/Tribe/PUE/Notices.php#L508 )
    So one way to solve this would be to change the string into something like:
    “With your %1$s license, you’re already using all your allowed installs…”
    If you want to know more about it, I’m ranting about this common error at https://gsm.fjellner.com/hints-about-i18n-let-your-code-to-shine-all-over-the-world/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Darian

    (@d0153)

    Hi @tobifjellner

    Thank you for your valuable feedback and recommendations!

    We appreciate you taking the time to share your insights. We have already created an internal ticket so our team can review it further and consider implementing it in a future update.

    Plugin Support Darian

    (@d0153)

    Hi there,

    This thread has been inactive for a while, so we’ll go ahead and close this for now. Please open a new thread if any other questions arise, and we’d be happy to help.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘i18n improvements needed’ is closed to new replies.