• Resolved elutkathefox

    (@elutkathefox)


    Hi!

    So I have 2 membership levels. When a not logged in user or logged in but without required membership tries to enter a course, he can see a message saying that one or the other membership is required.

    I’m failing to translate “and” in this message (“and” is between membership names). I can’t find this string for example in Loco Translate. I’ve found “and” but apparently it’s not the one, because translating it results in no change.

    The message looks like this now:
    “Ten kurs wymaga członkostwa ZAAWANSOWANY and PRO.”

    So it’s fully translatet except the “and”. Can you please tell me where to look for this string?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi! I think the “and” in the “shownoaccess” shortcode actually can be translated, at least it seems so when I look at the github code for PMPro. The pmpro_get_no_access_message() function calls pmpro_implodeToEnglish() to build the message string, and it contains a translation call:

    https://github.com/strangerstudios/paid-memberships-pro/blob/2190e731fbb7ccebfa07f246f926859de014e79a/includes/functions.php#L1847

    I went to investigate this because I also had an issue with the message built by PMPro: my language (brazillian portuguese) doesn’t allow the use of the “oxford comma” and I have three membership levels. I thought it would be easy to fix this using the pmpro_non_member_text_filter and pmpro_not_logged_in_text_filter filters, but they are run BEFORE the substitutions are made and the only data available for the filters is the text with the !! variables :(.

    I ended up using these filters to rewrite the whole function, parsing the shortcode of the current post to find out what the levels are and then building the “no access” message in a more personalized fashion (I can post it in a gist for you if you want, I just need to translate my comments from portuguese to english), but I think it would be nice if the PMPro devs could add a filter just before the return statement in pmpro_get_no_access_message()…

    https://github.com/strangerstudios/paid-memberships-pro/blob/2190e731fbb7ccebfa07f246f926859de014e79a/includes/functions.php#L1941

    …this would make it easy to fix any unforeseen translation issues 😀

    • This reply was modified 9 months, 1 week ago by nunks.
    • This reply was modified 9 months, 1 week ago by Yui.

    here’s the gist I mentioned above in my previous message (which was sadly blocked for moderation 🙁 )

    To rephrase it quickly: I think the “and” is translatable, it’s in the “pmpro_implodeToEnglish” function and calls a translation domain. I built the gist above because I needed to get rid of the “oxford comma”.

    Thread Starter elutkathefox

    (@elutkathefox)

    Hi! After what you said and checking the code you shared I’v decided to upload translation again and… it worked 🤦‍♀️

    And thanks for sharing your code. Fortunately I don’t have to use it, but I can feel your pain 😅

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘It’s not possible to translate “and”’ is closed to new replies.