State/Province not translated

This topic contains 2 replies, has 2 voices, and was last updated by  Luc Gagnon 6 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #29038

    Hi,

    I use your plugin in French and in the booking form, the State/Province is translated to ‘État/Région’ in the French po file. I would like to change the translation to ‘Province’ so I modified the po file but when I refresh the page, it’s still ‘État/Région’ that is showing. What can I do?

    Also, I bought the Business license but realised I would be better with the Developper license. Can I upgrade?

    Thanks,

    Luc

    Luc Gagnon
    #29043

    The .po file is just the human-readable file for editing translations. From that you would need to create a .mo file, which is what the plug-in uses for translation. Software like poedit can do that. You would also need to store it, appropriately named in wp-content/languages to prevent the changes from being lost on an update (see http://docs.wp-event-organiser.com/i18n/ for details).

    However, a much better way would be to use the following snippet:

    add_action( 'eventorganiser_get_event_booking_form', function( $form, $event_id ){
    
        $labels = array(
            'street-address' => __( 'Street Address', 'eventorganiserp' ),
            '2nd-line'       => __( 'Address Line 2', 'eventorganiserp' ),
            'city'           => __( 'City', 'eventorganiserp' ),
            'state'          => __( 'Region/County', 'eventorganiserp' ),
            'postcode'       => __( 'Postcode', 'eventorganiserp' ),
            'country'        => __( 'Country', 'eventorganiserp' ),
        );
    
        $elements = $form->flatten_elements();
    
        foreach( $elements as $element ){
            if( 'address' == $element->type ){
                $element->set( 'subfield_labels', $labels );
            }
        }
    }, 10, 2 );
    

    Just change the label values to whatever you want them to be.

    Yes, it’s possible to upgrade, I’ll be in touch with a discount code you can use to purchase a developer license.

    Stephen Harris
    #29046

    Thanks Stephen. I used poedit to edit the po file and uploaded both the po and mo file to the server but it didn’t change the label for State/Province. Using the snippet you sent did the trick.

    Luc

    Luc Gagnon
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.