Forums › Localization › Time Format and Month Format
Tagged: Timberland Boots definitely
This topic contains 4 replies, has 4 voices, and was last updated by hleson 5 days, 5 hours ago.
-
AuthorPosts
-
21 November 2012 at 14:47 #7537
Hello there,
We are working on a platform using Ushahidi and we wanted to point out some of ”improvements” that we applied to the Ushahidi code.
Problem: Localizations for Dates and Time (in Albanian) were not being shown properly in: Ushahidi_Folder/themes/default/views/reports/main.php even though the localization files are available here Ushahidi_Folder/application/i18n/sq_SQ/datetime.php and original file Ushahidi_Folder/application/i18n/en_US/datetime.php
—————————————-
Original main.php file
<h1 class=”heading”>
<?php echo Kohana::lang(‘ui_main.showing_reports_from’, array(date(‘M d, Y’, $oldest_timestamp), date(‘M d, Y’, $latest_timestamp))); ?$
<a href=”#” class=”btn-change-time ic-time”><?php echo Kohana::lang(‘ui_main.change_date_range’); ?></a>
</h1>—————————————-
keep in mind: You have to change the localization file datetime.php and the original in English, where months should look like this: with CAPITAL first letter
‘November’ => array(
‘abbv’ => ‘Nën’,
‘full’ => ‘Nëntor’,
),http://pastebin.com/cn9XTUPa && http://pastebin.com/Lwh6F3fA
then we go back to main.php
We changed to this:
<h1 class=”heading”>
<?php
$month_old = date(‘F’, $oldest_timestamp);
$month_new = date(‘F’,$latest_timestamp);
$r_month_old = Kohana::lang(‘datetime.’.$month_old.’.abbv’);
$r_month_new = Kohana::lang(‘datetime.’.$month_new.’.abbv’);
$timeframe_title = str_replace($month_old,$r_month_old, date(‘d F, Y’, $oldest_timestamp)).’ ‘.Kohana::lang(‘ui_main.through’).’ ‘.str_replace($month_new, $r_month_new,date(‘d F, Y’, $latest_timestamp));
?>
<?php echo Kohana::lang(‘ui_main.showing_reports_from’); ?>
<span class=”time-period”><?php echo $timeframe_title; ?></span>
<a href=”#” class=”btn-change-time ic-time”><?php echo Kohana::lang(‘ui_main.change_date_range’); ?></a>
</h1>The other one is Time Format am&pm
<div class=”report_row” id=”datetime_default”>
<h4>
<a href=”#” id=”date_toggle” class=”show-more”><?php echo Kohana::lang(‘ui_main.modify_date’); ?></a>
<?php echo Kohana::lang(‘ui_main.date_time’); ?>:
<?php echo Kohana::lang(‘ui_main.today_at’).” “.”<span id=’current_time’>”.$form['incident_hour']
.”:”.$form['incident_minute'].” “.$form['incident_ampm'].”</span>”; ?>
<?php if($site_timezone != NULL): ?>
<small>(<?php echo $site_timezone; ?>)</small>
<?php endif; ?>
</h4>
</div>This is based on your language:
<div class=”report_row” id=”datetime_default”>
<h4>
<a href=”#” id=”date_toggle” class=”show-more”><?php echo Kohana::lang(‘ui_main.modify_date’); ?></a>
<?php echo Kohana::lang(‘ui_main.date_time’); ?>:
<?php echo Kohana::lang(‘ui_main.today_at’).” “.”<span id=’current_time’>”.$form['incident_hour']
.”:”.$form['incident_minute'].” “.Kohana::lang(‘datetime.’.$form['incident_ampm']).”</span>”; ?>
<?php if($site_timezone != NULL): ?>
<small>(<?php echo $site_timezone; ?>)</small>
<?php endif; ?>
</h4>
</div>30 November 2012 at 15:05 #7643Thanks so much. I’ll share this with the development team.
Of note,
We are localizing Ushahidi using transifex. Here are details on how it works:
https://wiki.ushahidi.com/display/WIKI/Localization+and+Translation
https://www.transifex.net/projects/p/ushahidi-localizations/
Heather
3 December 2012 at 00:09 #7661Hi,
Are you managing your code in github? It’d be great to see a diff of these changes, or even better if you could send a pull request with these improvements [https://help.github.com/articles/using-pull-requests]
Localizing dates is something I looked at briefly before, its done in a couple of JS libraries already. However I haven’t had time to go further, part of the problem is that simply swapping and English month name for another language isn’t correct, as other languages often use different formats etc. There are other libraries that solve this problem, for instance Zend_Date, but theres still some work to integrate one of these.
Robbie
3 December 2012 at 10:05 #7665A date and time format string defines the text representation of a DateTime .The “d” custom format specifier represents the day of the month as a number.
20 May 2013 at 21:41 #12591There is a github issue on this topic. Maybe you could add notes?
https://github.com/ushahidi/Ushahidi_Web/issues/1047
heather -
AuthorPosts
You must be logged in to reply to this topic.