agileware / wp-civicrm-ux

WordPress CiviCRM UX - User Experience enhancements
GNU General Public License v2.0
7 stars 12 forks source link

Translation #6

Open jbonlinea opened 3 years ago

jbonlinea commented 3 years ago

Hi,

I'm on the way to use this plug-in and consider translating it to french, however language/civicrm-ux.pot is empty so I wonder what are the chains that may be translatable ?

Regards

agileware-justin commented 3 years ago

@jbonlinea no idea sorry, will happily accept your efforts to implement translation for this plugin.

jbonlinea commented 3 years ago

Hi,

One question. Where do the text actually displayed by the shortcodes (let's narrow it to the member shortcode) comes from ? Your plug-in or straight from Civi ?

I mean do your plug-in has any text or string that are displayed on the front end, or 100% of what is displayed comes from Civi strings ?

Knowing this will help to figure what could be translated and where from.

Regards

agileware-justin commented 3 years ago

@jbonlinea might want to read this page, https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/

christianwach commented 3 years ago

@agileware-justin I think @jbonlinea means that the plugin's .pot file is empty and therefore no .po and .mo files can be generated and stored outside the plugin's directory in the alternative places that WordPress provides. It's a good idea to regenerate the .pot file every time a new version of the plugin is tagged.

christianwach commented 3 years ago

@agileware-justin There are two ways this can be done:

agileware-justin commented 3 years ago

We will happily accept any PRs / submissions to set up translation for this plugin.

jbonlinea commented 3 years ago

Hi,

Well I meant two thing, one like @christianwach outlines above, and the other is what part of the "text/data" displayed by the shortcode is comming from civicrm and what could be translated in a .po file ?

for instance [ux_membership_type] : returns exactly the civi membership type label, while [ux_membership_expiry] return "Your membership expires on décembre 31st, 2021". On this second example is "Your membership expires on" comming from your plug-in and "décembre 31st, 2021" from civi, or your plug iget the the expiry date from civi and format it berore placing it into the whole string ? I also need to know that to tackle a translation (especially since different countries have different standard to display date and such). With pot file I could indeed look for the string and get it myself :)

I won't address this at right now as there are more critical things to address first, and I'm know thinking that one could get the value with the data processor and format it or place it in a phrase as he wants so there may already be a working and flexible solution for all :)

christianwach commented 3 years ago

@jbonlinea Unfortunately, that string isn't translatable at all because it's hard-coded in the plugin. The code should read:

$membership_summary_message .= '<div>' . sprintf( __( '%1$s member - %2$s. Your membership expires on %3$s', 'civicrm-ux' ), $membership_types, $membership_summary_status, $end_date_format ) . '</div><div>' . '<a href="' . esc_url( $summary_show_renewal_URL ) . '">' . __( 'Click here to renew your membership', 'civicrm-ux' ) . '</a></div>';

You're going to have to apply the same kinds of changes to all the text in this plugin in order to translate it into French.

jbonlinea commented 2 years ago

You're going to have to apply the same kinds of changes to all the text in this plugin in order to translate it into French.

Yeah, well the point was to have translations to used both french and english ; and I could have provided the french translations at least, and eventually a couple others with some quick review.

English will do for the time being