Improve "ago" string for languages other than English
Using H5P on a WordPress site.
Numbers in brackets refer to the attached screenshot.
On the All H5P Content page, the Last modified column display is correct for English (1) but incorrect for those languages which place the time and time-word(s) in the opposite order, such as French and Spanish. In the current h5p-fr_FR.po file, "ago" has been translated by "avant", which is an - unsatisfactory - attempt at solving the problem (2).
I suggest that the real solution is to attach a parameter to the "ago" string, along the following lines.
1.- in file class-h5p-content-admin.php around line 805
replace
$human_time = human_time_diff($time + $offset, $current_time) . ' ' . __('ago', $this->plugin_slug);
with
$timediff = human_time_diff($time + $offset, $current_time);
$human_time = sprintf(__('%s ago', $this->plugin_slug), $timediff);
2.- using a translation tool such as Poedit, in your wordpress site at /wp-content/plugins/h5p/languages open a language file, e.g. h5p-fr_FR.po; Tab Catalogue->Update from sources.
Translate the "%s ago" string into the current po language, e.g. "il y a %s" for French and Save the file.
See result for French (3) and Spanish (4) on the attached screenshots.
Note.- Also the display of full date as yyyy/mm/dd is quite misleading even for English language users, and should be correctly localized. See my post here: https://h5p.org/node/35289.
tim
Fri, 12/02/2016 - 09:58
Permalink
Great catch. I've now moved a
Great catch. I've now moved a copy of this to the Feature Request forum.
Would you be able to make a pull request with the code changes you suggested?
papi Jo
Wed, 12/07/2016 - 22:50
Permalink
Question about pull requests on github
Hi tim, today I have made pull requests for my suggested changes to improve the "ago" display for languages other than English.
1.- I have included in my request the French translation file. Translators of other languages should be informed of the change. How to do it? Who will do it?
2.- Although I've used Github for a number of years (for Moodle) this is the first time I have made a "pull request". I thought I would make separate requests for several changes, but I notice that the 2 requests I made today are "merged" into a single request. Is this the normal way of things? I will have a number of other requests to make in the coming days, how can they be made "separate"?
If you prefer you can email me directly at [email protected]
Thanks!
otacke
Thu, 12/08/2016 - 09:35
Permalink
use branches
If you want to create multiple pull requests for multiple features, you should use branches.
tim
Thu, 12/08/2016 - 11:10
Permalink
I agree with otacke, if
I agree with otacke, if multiple changes need to happen, your best bet is to create a new branch.
The benefits of using a new branch are that multiple interdependent changes can be made together. It then becomes easier to merge it into the main codebase as the Core Team can review all the changes at once.
This is what I recommend doing:
I would continue doing this for all the different types changes you wish to make. For example, it would have been a bit easier to handle the most recent pull request: https://github.com/h5p/h5p-wordpress-plugin/pull/42 if it was split up into different ones. If you have the time, it would be a tremendous help :)
papi Jo
Thu, 12/08/2016 - 11:31
Permalink
Thanks!
Thanks for your suggestions, tim & otacke,
I will look into this and try to understand the best process for my further commits!
papi Jo
Sat, 12/10/2016 - 11:26
Permalink
Hope I got it right now! Just
Hope I got it right now! Just created a new pull request for the "ago" improvement suggestion.
tim
Mon, 12/12/2016 - 09:55
Permalink
Good stuff. I'll get round to
Good stuff. I'll get round to reviewing it in the next couple of days.