Forum Replies Created

Viewing 14 replies - 1 through 14 (of 14 total)
  • Hi,
    Same problem here: the plugin disappeared from the plugins page, but when I try to reinstall it I got an error because the directory already exists…
    The “Extended Views” plugin is still there.
    Any idea about what happened ?
    Clement

    Thanks paulcoppock.
    I didn’t have much time to play with this plugin yet, but this is going to be useful soon.

    Hi Alexander,
    Would you mind to share your solution?
    I’m pretty sure it will help some other users! (including me ^^)
    Thanks,
    Clement

    Thread Starter solidaritelocale

    (@solidaritelocale)

    Sorry for the late answer.

    I confirm that putting .po and .mo files in the /wp-content/languages/plugins/ folder works. No subfolder.

    Source: https://developer.ww.wp.xz.cn/plugins/internationalization/localization/#using-localizations

    The 2 files have to be renamed with the exact name of the plugin, followed the code of the country_language. Example: wired-impact-volunteer-management-fr_FR.po

    Useful list of country and language codes: https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html

    Another useful link, to test the date format for the translation: http://sqa.fyicenter.com/Online_Test_Tools/Test_date_PHP_Function.php

    Thread Starter solidaritelocale

    (@solidaritelocale)

    Just like the phone numbers, everything here is working perfectly, congratulations!
    Dates and times are stored just fine, the display is using the format provided in the translation and the words in the right language. Perfect.

    Thread Starter solidaritelocale

    (@solidaritelocale)

    Hi Jonathan,
    I tested it with the plugin update and the completed translation, and it works like a charm. Congratulation to you and the Wired Impact dev team!
    I’m glad if my idea have been of any help. I like regex, they are soooo powerfull.

    Thread Starter solidaritelocale

    (@solidaritelocale)

    Regex way:

    US format:
    preg_replace(‘/^(\d{3})(\d{3})(\d{4})$/i’, ‘($1)$2-$3’, $unformatted_number);

    french format:
    preg_replace(‘/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/i’, ‘$1 $2 $3 $4 $5’, $unformatted_number);

    A part of this line could be an entry in the translation for every language to have a way to match their own format. Quite easy to adapt when you have an example.

    Thread Starter solidaritelocale

    (@solidaritelocale)

    Hmmm, I didn’t see this post before, sorry…
    I don’t know how to use filters within WP.
    As I wrote in the other topic, I modified the function that format the phone number so now it’s displayed in the french format, but I guess the way you suggested is much more elegant!

    original code:
    $formatted_number = ‘(‘ . substr( $unformatted_number, 0, 3 ) . ‘) ‘. substr( $unformatted_number, 3, 3 ) . ‘-‘ . substr( $unformatted_number, 6 );

    my attempt:
    $formatted_number = substr( $unformatted_number, 0, 2 ) . ‘ ‘ . substr( $unformatted_number, 2, 2 ) . ‘ ‘ . substr( $unformatted_number, 4, 2 ) . ‘ ‘ . substr( $unformatted_number, 6, 2 ) . ‘ ‘ . substr( $unformatted_number, 8 );

    A loop would be cleaner, and a regex even more!

    Thread Starter solidaritelocale

    (@solidaritelocale)

    Hi again,

    I found the way to load the translation:
    The .po and .mo files are renamed “wired-impact-volunteer-management-fr_FR” and put in the folder /wordpress/wp-content/languages/plugins and it works !

    As you said, the translation of date & time formats are only for display.
    I found another way to display the date in a french format (see my post on the other topic with locale and strftime) as the date and time are saved as a timestamp.

    I wonder if it could be a way for your timepicker problem: dealing only with the timestamp in the code, and displaying it with strftime in the form? It would decrease the need of parsing, and display the date in the right language, according to the setlocale setting. (naive idea from a non-developper ^^)

    I hope you’re still working on it, because my way of doing it is ugly!

    Thread Starter solidaritelocale

    (@solidaritelocale)

    Hi Jonathan,

    I’ve tried some new things:

    – changing the date format in the translation
    => the date & time is displayed in the right order for french readers, but days and months names are still in english

    – changing the locale and using strftime() rather than date()
    => the date & time are french-fliendly, at last!
    ==>> small problem : the “format string” used by stfrtime() is different from the one from date(), so the format strings in the translation have to be modified accordingly. (using % sign)
    ==>> other problem : I don’t know where to define the locale globally, so for now my way of doing it is quite dirty for now…

    – the datepicker won’t work at all, even with a clean install of your plugin: like I wrote in my first post, the date chosen with the datepicker is put in the form, but is disappear when I save the page.

    – I managed to display the phone number in the french standard, but one agin it’s hardcoded and dirty… maybe the phone format could be in the translation too, using regex, but I don’t have the knowledge to do that!

    —–
    examples:

    strftime instead of date:
    setlocale(LC_TIME, ‘fr’,’fr_FR’,’fr_FR.utf8′,’fra’);
    // $opp_time = date( __( ‘D, F d, Y g:i a’, ‘wired-impact-volunteer-management’ ), $start_date_time);
    $opp_time = strftime(“%A %d %B %Y %H:%M”, $start_date_time);

    phone number format:
    // $formatted_number = ‘(‘ . substr( $unformatted_number, 0, 3 ) . ‘) ‘. substr( $unformatted_number, 3, 3 ) . ‘-‘ . substr( $unformatted_number, 6 );
    $formatted_number = substr( $unformatted_number, 0, 2 ) . ‘ ‘ . substr( $unformatted_number, 2, 2 ) . ‘ ‘ . substr( $unformatted_number, 4, 2 ) . ‘ ‘ . substr( $unformatted_number, 6, 2 ) . ‘ ‘ . substr( $unformatted_number, 8 );

    Thread Starter solidaritelocale

    (@solidaritelocale)

    As far as the date formats, I don’t think translations are going to help.

    Actually, it may be the way to go!

    I search the plugin’s files to see where the format was applied, it’s in public function format_opp_times in class-opportunity.php.

    When applying the format, it calls a gettext string. So by providing another coded date format in the translation, we should be able to change the format of the displayed date.
    It’s actually very clever, as each translation can provide a format that fits the language.

    The french date format should be something like “D l F Y”.
    I’d like to give it a try, but I can’t get my translation to load…
    The .po end .mo files (renamed or not) in the languages directory doesn’t seem to be enough, I have to do some more reading about it.

    Thread Starter solidaritelocale

    (@solidaritelocale)

    It’s good to know that you are working on it !

    I got almost the same issue with the phone number format. The french format is quite different, so when the plugin applies the US format on it, it becomes difficult to read for french people.
    Even when I enter only numbers (ex: 0123456789) it transforms it into (012) 345-6789.

    Could you point me the file where I can change that ?
    Is the format applied only when the number is displayed, or is it written with this format in the database ?

    Note : If there is a way to change that, it should be adapted in the translation too :
    “Please enter your phone number in the format (000) 000-0000.”

    Thread Starter solidaritelocale

    (@solidaritelocale)

    The french translation is almost complete.

    Some notes about it :
    – a few expressions are a little confusing without context and I could’nt find them in the current plugin, so I’ll complete them when the translation will be running on my WP.
    – the word “opportunity” has an equivalent in french, but it doesn’t fit perfectly. I used it anyway because the previous contributers used it, but maybe it should be replace by “événement” later…
    – there is translations for the date format, could it be the way to go for what we discuss on the other topic ? I didn’t provide a french date format yet, but I can if you think it could work.

    How can I use the pending translation to test it ? Is exporting the .po file enough ?

    Thread Starter solidaritelocale

    (@solidaritelocale)

    Well, I looked at the translation, and this element wasn’t translated yet. So my guess that it should use the WP “read more” was wrong!

    I’m working on the french translation now.

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