Skip to content

Instantly share code, notes, and snippets.

Created September 20, 2011 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1230234 to your computer and use it in GitHub Desktop.
Save anonymous/1230234 to your computer and use it in GitHub Desktop.
Patch for All-in-one Event Calendar 1.0.6 to fix some translation issues
diff -Naur all-in-one-event-calendar/app/controller/class-ai1ec-calendar-controller.php all-in-one-event-calendar-patched/app/controller/class-ai1ec-calendar-controller.php
--- all-in-one-event-calendar/app/controller/class-ai1ec-calendar-controller.php 2011-09-15 11:07:29.000000000 +0200
+++ all-in-one-event-calendar-patched/app/controller/class-ai1ec-calendar-controller.php 2011-09-20 13:47:18.921875000 +0200
@@ -225,7 +225,7 @@
$pagination_links = $ai1ec_calendar_helper->get_month_pagination_links( $month_offset );
$view_args = array(
- 'title' => gmstrftime( '%B %Y', $timestamp ),
+ 'title' => date_i18n( 'F Y', $timestamp ),
'weekdays' => $ai1ec_calendar_helper->get_weekdays(),
'cell_array' => $cell_array,
'pagination_links' => $pagination_links,
@@ -277,7 +277,7 @@
// Incorporate offset into date
$args = array(
- 'title' => __( 'Agenda' ),
+ 'title' => __( 'Agenda', AI1EC_PLUGIN_NAME ),
'dates' => $dates,
'page_offset' => $page_offset,
'pagination_links' => $pagination_links,
diff -Naur all-in-one-event-calendar/app/helper/class-ai1ec-calendar-helper.php all-in-one-event-calendar-patched/app/helper/class-ai1ec-calendar-helper.php
--- all-in-one-event-calendar/app/helper/class-ai1ec-calendar-helper.php 2011-09-15 11:07:29.000000000 +0200
+++ all-in-one-event-calendar-patched/app/helper/class-ai1ec-calendar-helper.php 2011-09-20 12:11:23.703125000 +0200
@@ -483,7 +483,7 @@
$weekdays = array();
for( $i = 0; $i < 7; $i++ ) {
- $weekdays[] = strftime( '%a', $time );
+ $weekdays[] = date_i18n( 'D', $time );
$time += 60 * 60 * 24; // Add a day
}
}
@@ -521,12 +521,12 @@
);
$links[] = array(
'id' => 'ai1ec-prev-month',
- 'text' => '‹ ' . gmstrftime( '%B', gmmktime( 0, 0, 0, $bits['mon'] - 1, 1, $bits['year'] ) ),
+ 'text' => '‹ ' . date_i18n( 'M', gmmktime( 0, 0, 0, $bits['mon'] - 1, 1, $bits['year'] ) ),
'href' => '#action=ai1ec_month&ai1ec_month_offset=' . ( $cur_offset - 1 ),
);
$links[] = array(
'id' => 'ai1ec-next-month',
- 'text' => gmstrftime( '%B', gmmktime( 0, 0, 0, $bits['mon'] + 1, 1, $bits['year'] ) ) . ' ›',
+ 'text' => date_i18n( 'M', gmmktime( 0, 0, 0, $bits['mon'] + 1, 1, $bits['year'] ) ) . ' ›',
'href' => '#action=ai1ec_month&ai1ec_month_offset=' . ( $cur_offset + 1 ),
);
$links[] = array(
diff -Naur all-in-one-event-calendar/app/helper/class-ai1ec-events-helper.php all-in-one-event-calendar-patched/app/helper/class-ai1ec-events-helper.php
--- all-in-one-event-calendar/app/helper/class-ai1ec-events-helper.php 2011-09-15 11:07:29.000000000 +0200
+++ all-in-one-event-calendar-patched/app/helper/class-ai1ec-events-helper.php 2011-09-20 15:18:02.625000000 +0200
@@ -305,25 +305,30 @@
* equivalents
*/
function get_repeat_patterns() {
- static $options = array(
- ' ' => 'No repeat',
- 'DAILY' => 'Daily',
- 'MO' => 'Mondays',
- 'TU' => 'Tuesdays',
- 'WE' => 'Wednesdays',
- 'TH' => 'Thursdays',
- 'FR' => 'Fridays',
- 'SA' => 'Saturdays',
- 'SU' => 'Sundays',
- 'TU+TH' => 'Tuesdays & Thursdays',
- 'MO+WE+FR' => 'Mondays, Wednesdays & Fridays',
- 'WEEKDAYS' => 'Weekdays',
- 'WEEKENDS' => 'Weekends',
- 'WEEKLY' => 'Weekly',
- 'MONTHLY' => 'Monthly',
- 'YEARLY' => 'Yearly',
- );
-
+ /* Calling functions when creating an array does not seem to work when
+ the assigned to variable is static. This is a workaround. */
+ static $options;
+ if (!isset($options)) {
+ $temp = array(
+ ' ' => __( 'No repeat', AI1EC_PLUGIN_NAME ),
+ 'DAILY' => __( 'Daily', AI1EC_PLUGIN_NAME ),
+ 'MO' => __( 'Mondays', AI1EC_PLUGIN_NAME ),
+ 'TU' => __( 'Tuesdays', AI1EC_PLUGIN_NAME ),
+ 'WE' => __( 'Wednesdays', AI1EC_PLUGIN_NAME ),
+ 'TH' => __( 'Thursdays', AI1EC_PLUGIN_NAME ),
+ 'FR' => __( 'Fridays', AI1EC_PLUGIN_NAME ),
+ 'SA' => __( 'Saturdays', AI1EC_PLUGIN_NAME ),
+ 'SU' => __( 'Sundays', AI1EC_PLUGIN_NAME ),
+ 'TU+TH' => __( 'Tuesdays & Thursdays', AI1EC_PLUGIN_NAME ),
+ 'MO+WE+FR' => __( 'Mondays, Wednesdays & Fridays', AI1EC_PLUGIN_NAME ),
+ 'WEEKDAYS' => __( 'Weekdays', AI1EC_PLUGIN_NAME ),
+ 'WEEKENDS' => __( 'Weekends', AI1EC_PLUGIN_NAME ),
+ 'WEEKLY' => __( 'Weekly', AI1EC_PLUGIN_NAME ),
+ 'MONTHLY' => __( 'Monthly', AI1EC_PLUGIN_NAME ),
+ 'YEARLY' => __( 'Yearly', AI1EC_PLUGIN_NAME )
+ );
+ $options = $temp;
+ }
return $options;
}
@@ -647,12 +652,10 @@
* @return string
**/
function get_short_time( $timestamp, $convert_from_gmt = true ) {
+ $time_format = get_option( 'time_format', 'g:ia' );
if( $convert_from_gmt )
$timestamp = $this->gmt_to_local( $timestamp );
- $ampm = gmstrftime( '%p', $timestamp );
- $ampm = $ampm[0];
- $ampm = strtolower( $ampm );
- return gmstrftime( '%l:%M', $timestamp ) . $ampm;
+ return date_i18n( $time_format, $timestamp, true );
}
/**
@@ -669,7 +672,7 @@
function get_short_date( $timestamp, $convert_from_gmt = true ) {
if( $convert_from_gmt )
$timestamp = $this->gmt_to_local( $timestamp );
- return gmstrftime( '%b %e', $timestamp );
+ return date_i18n( 'M j', $timestamp );
}
/**
@@ -683,11 +686,10 @@
* @return string
**/
function get_medium_time( $timestamp, $convert_from_gmt = true ) {
+ $time_format = get_option( 'time_format', 'g:ia' );
if( $convert_from_gmt )
$timestamp = $this->gmt_to_local( $timestamp );
- $ampm = gmstrftime( '%p', $timestamp );
- $ampm = strtolower( $ampm );
- return gmstrftime( '%l:%M', $timestamp ) . $ampm;
+ return date_i18n( $time_format, $timestamp, true );
}
/**
@@ -702,11 +704,13 @@
* @return string
**/
function get_long_time( $timestamp, $convert_from_gmt = true ) {
+ $date_format = get_option( 'date_format', 'D, F j' );
+ $time_format = get_option( 'time_format', 'g:i' );
if( $convert_from_gmt )
$timestamp = $this->gmt_to_local( $timestamp );
- $ampm = gmstrftime( '%p', $timestamp );
- $ampm = strtolower( $ampm );
- return gmstrftime( '%a, %B %e @ %l:%M', $timestamp ) . $ampm;
+ return date_i18n( $date_format, $timestamp )
+ . ' @ '
+ . date_i18n( $time_format, $timestamp );
}
/**
@@ -721,9 +725,10 @@
* @return string
**/
function get_long_date( $timestamp, $convert_from_gmt = true ) {
+ $date_format = get_option( 'date_format', 'D, F j' );
if( $convert_from_gmt )
$timestamp = $this->gmt_to_local( $timestamp );
- return gmstrftime( '%a, %B %e', $timestamp );
+ return date_i18n( $date_format, $timestamp );
}
/**
@@ -961,16 +966,16 @@
ob_start();
$options = array(
- 0 => 'Never',
- 1 => 'After',
- 2 => 'On date'
+ 0 => __( 'Never', AI1EC_PLUGIN_NAME ),
+ 1 => __( 'After', AI1EC_PLUGIN_NAME ),
+ 2 => __( 'On date', AI1EC_PLUGIN_NAME )
);
?>
<select name="ai1ec_end" id="ai1ec_end">
<?php foreach( $options as $key => $val ): ?>
<option value="<?php echo $key ?>" <?php if( $key === $selected ) echo 'selected="selected"' ?>>
- <?php _e( $val, AI1EC_PLUGIN_NAME ) ?>
+ <?php echo $val ?>
</option>
<?php endforeach ?>
</select>
diff -Naur all-in-one-event-calendar/app/helper/class-ai1ec-settings-helper.php all-in-one-event-calendar-patched/app/helper/class-ai1ec-settings-helper.php
--- all-in-one-event-calendar/app/helper/class-ai1ec-settings-helper.php 2011-09-15 11:07:29.000000000 +0200
+++ all-in-one-event-calendar-patched/app/helper/class-ai1ec-settings-helper.php 2011-09-20 22:26:21.406250000 +0200
@@ -82,7 +82,7 @@
class="wafp-dropdown wafp-pages-dropdown">
<?php if( ! empty( $auto_page ) ) { ?>
<option value="__auto_page:<?php echo $auto_page; ?>">
- <?php _e( '- Auto-Create New Page -', THE_PLUGIN_NAME ); ?>
+ <?php _e( '- Auto-Create New Page -', AI1EC_PLUGIN_NAME ); ?>
</option>
<?php }
foreach( $pages as $page ) {
diff -Naur all-in-one-event-calendar/app/view/agenda-widget.php all-in-one-event-calendar-patched/app/view/agenda-widget.php
--- all-in-one-event-calendar/app/view/agenda-widget.php 2011-09-15 11:07:29.000000000 +0200
+++ all-in-one-event-calendar-patched/app/view/agenda-widget.php 2011-09-20 13:51:33.296875000 +0200
@@ -8,7 +8,7 @@
<?php if( ! $dates ): ?>
<p class="ai1ec-no-results">
- <?php _e( 'There are no upcoming events.' ) ?>
+ <?php _e( 'There are no upcoming events.', AI1EC_PLUGIN_NAME ) ?>
</p>
<?php else: ?>
<ol>
diff -Naur all-in-one-event-calendar/app/view/agenda.php all-in-one-event-calendar-patched/app/view/agenda.php
--- all-in-one-event-calendar/app/view/agenda.php 2011-09-15 11:07:29.000000000 +0200
+++ all-in-one-event-calendar-patched/app/view/agenda.php 2011-09-20 13:51:33.281250000 +0200
@@ -2,14 +2,14 @@
<span class="ai1ec-title-buttons">
<?php if( $dates ): ?>
<a id="ai1ec-expand-all" class="ai1ec-button">
- <?php _e( '+ Expand All', AI1EC_JS_URL ) ?>
+ <?php _e( '+ Expand All', AI1EC_PLUGIN_NAME ) ?>
</a><a
id="ai1ec-collapse-all" class="ai1ec-button">
- <?php _e( '− Collapse All', AI1EC_JS_URL ) ?>
+ <?php _e( '− Collapse All', AI1EC_PLUGIN_NAME ) ?>
</a
><?php endif ?><a
id="ai1ec-today" class="ai1ec-load-view ai1ec-button" href="#action=ai1ec_agenda">
- <?php _e( 'Today', AI1EC_JS_URL ) ?>
+ <?php _e( 'Today', AI1EC_PLUGIN_NAME ) ?>
</a>
</span>
<ul class="ai1ec-pagination">
@@ -25,15 +25,15 @@
<ol class="ai1ec-agenda-view">
<?php if( ! $dates ): ?>
<p class="ai1ec-no-results">
- <?php _e( 'There are no upcoming events to display at this time.' ) ?>
+ <?php _e( 'There are no upcoming events to display at this time.', AI1EC_PLUGIN_NAME ) ?>
</p>
<?php else: ?>
<?php foreach( $dates as $timestamp => $date_info ): ?>
<li class="ai1ec-date <?php if( $date_info['today'] ) echo 'ai1ec-today' ?>">
<h3 class="ai1ec-date-title">
- <div class="ai1ec-month"><?php echo strftime( '%b', $timestamp ) ?></div>
- <div class="ai1ec-day"><?php echo strftime( '%e', $timestamp ) ?></div>
- <div class="ai1ec-weekday"><?php echo strftime( '%a', $timestamp ) ?></div>
+ <div class="ai1ec-month"><?php echo date_i18n( 'M', $timestamp ) ?></div>
+ <div class="ai1ec-day"><?php echo date_i18n( 'j', $timestamp ) ?></div>
+ <div class="ai1ec-weekday"><?php echo date_i18n( 'D', $timestamp ) ?></div>
</h3>
<ol class="ai1ec-date-events">
<?php foreach( $date_info['events'] as $category ): ?>
@@ -54,7 +54,7 @@
<div class="ai1ec-event-title">
<?php echo esc_html( $event->post->post_title ) ?>
<?php if( $event->allday ): ?>
- <span class="ai1ec-allday-label"><?php _e( '(all-day)' ) ?></span>
+ <span class="ai1ec-allday-label"><?php _e( '(all-day)', AI1EC_PLUGIN_NAME ) ?></span>
<?php endif ?>
</div>
<div class="ai1ec-event-time">
@@ -72,7 +72,7 @@
<div class="ai1ec-event-overlay">
<a class="ai1ec-read-more ai1ec-button"
href="<?php echo esc_attr( get_permalink( $event->post_id ) ) ?>">
- <?php _e( 'Read more »', AI1EP_PLUGIN_NAME ) ?>
+ <?php _e( 'Read more »', AI1EC_PLUGIN_NAME ) ?>
</a>
<?php if( $event->categories_html ): ?>
<div class="ai1ec-categories">
@@ -104,7 +104,7 @@
<div class="ai1ec-event-title">
<?php echo esc_html( $event->post->post_title ) ?>
<?php if( $event->allday ): ?>
- <span class="ai1ec-allday-label"><?php _e( '(all-day)' ) ?></span>
+ <span class="ai1ec-allday-label"><?php _e( '(all-day)', AI1EC_PLUGIN_NAME ) ?></span>
<?php endif ?>
</div>
</div>
diff -Naur all-in-one-event-calendar/app/view/box_event_contact.php all-in-one-event-calendar-patched/app/view/box_event_contact.php
--- all-in-one-event-calendar/app/view/box_event_contact.php 2011-09-15 11:07:29.000000000 +0200
+++ all-in-one-event-calendar-patched/app/view/box_event_contact.php 2011-09-20 13:46:33.171875000 +0200
@@ -1,10 +1,10 @@
-<h4 class="ai1ec-section-title"><?php _e( 'Organizer contact info', 'ai1ec' ); ?></h4>
+<h4 class="ai1ec-section-title"><?php _e( 'Organizer contact info', AI1EC_PLUGIN_NAME ); ?></h4>
<table class="ai1ec-form">
<tbody>
<tr>
<td class="ai1ec-first">
<label for="ai1ec_contact_name">
- <?php _e( 'Contact name:', 'ai1ec' ); ?>
+ <?php _e( 'Contact name:', AI1EC_PLUGIN_NAME ); ?>
</label>
</td>
<td>
@@ -14,7 +14,7 @@
<tr>
<td>
<label for="ai1ec_contact_phone">
- <?php _e( 'Phone:', 'ai1ec' ); ?>
+ <?php _e( 'Phone:', AI1EC_PLUGIN_NAME ); ?>
</label>
</td>
<td>
@@ -24,7 +24,7 @@
<tr>
<td>
<label for="ai1ec_contact_email">
- <?php _e( 'E-mail:', 'ai1ec' ); ?>
+ <?php _e( 'E-mail:', AI1EC_PLUGIN_NAME ); ?>
</label>
</td>
<td>
diff -Naur all-in-one-event-calendar/app/view/box_event_cost.php all-in-one-event-calendar-patched/app/view/box_event_cost.php
--- all-in-one-event-calendar/app/view/box_event_cost.php 2011-09-15 11:07:29.000000000 +0200
+++ all-in-one-event-calendar-patched/app/view/box_event_cost.php 2011-09-20 13:46:33.187500000 +0200
@@ -1,10 +1,10 @@
-<h4 class="ai1ec-section-title"><?php _e( 'Event cost', 'ai1ec' ); ?></h4>
+<h4 class="ai1ec-section-title"><?php _e( 'Event cost', AI1EC_PLUGIN_NAME ); ?></h4>
<table class="ai1ec-form">
<tbody>
<tr>
<td class="ai1ec-first">
<label for="ai1ec_cost">
- <?php _e( 'Cost', 'ai1ec' ); ?>:
+ <?php _e( 'Cost', AI1EC_PLUGIN_NAME ); ?>:
</label>
</td>
<td>
diff -Naur all-in-one-event-calendar/app/view/box_event_location.php all-in-one-event-calendar-patched/app/view/box_event_location.php
--- all-in-one-event-calendar/app/view/box_event_location.php 2011-09-15 11:07:29.000000000 +0200
+++ all-in-one-event-calendar-patched/app/view/box_event_location.php 2011-09-20 13:45:27.250000000 +0200
@@ -1,10 +1,10 @@
-<h4 class="ai1ec-section-title"><?php _e( 'Event location details', 'ai1ec' ); ?></h4>
+<h4 class="ai1ec-section-title"><?php _e( 'Event location details', AI1EC_PLUGIN_NAME ); ?></h4>
<table class="ai1ec-form ai1ec-location-form">
<tbody>
<tr>
<td class="ai1ec-first">
<label for="ai1ec_venue">
- <?php _e( 'Venue name:', 'ai1ec' ); ?>
+ <?php _e( 'Venue name:', AI1EC_PLUGIN_NAME ); ?>
</label>
</td>
<td>
@@ -14,7 +14,7 @@
<tr>
<td>
<label for="ai1ec_address">
- <?php _e( 'Address:', 'ai1ec' ); ?>
+ <?php _e( 'Address:', AI1EC_PLUGIN_NAME ); ?>
</label>
</td>
<td>
@@ -24,7 +24,7 @@
<tr>
<td>
<label for="ai1ec_google_map">
- <?php _e( 'Show Google Map:', 'ai1ec' ); ?>
+ <?php _e( 'Show Google Map:', AI1EC_PLUGIN_NAME ); ?>
</label>
</td>
<td>
diff -Naur all-in-one-event-calendar/app/view/box_time_and_date.php all-in-one-event-calendar-patched/app/view/box_time_and_date.php
--- all-in-one-event-calendar/app/view/box_time_and_date.php 2011-09-15 11:07:29.000000000 +0200
+++ all-in-one-event-calendar-patched/app/view/box_time_and_date.php 2011-09-20 13:46:33.171875000 +0200
@@ -1,11 +1,11 @@
<?php wp_nonce_field( 'ai1ec', AI1EC_POST_TYPE ); ?>
-<h4 class="ai1ec-section-title"><?php _e( 'Event date and time'); ?></h4>
+<h4 class="ai1ec-section-title"><?php _e( 'Event date and time', AI1EC_PLUGIN_NAME ); ?></h4>
<table class="ai1ec-form">
<tbody>
<tr>
<td class="ai1ec-first">
<label for="ai1ec_all_day_event">
- <?php _e( 'All-day event', 'ai1ec' ); ?>?
+ <?php _e( 'All-day event', AI1EC_PLUGIN_NAME ); ?>?
</label>
</td>
<td>
@@ -15,7 +15,7 @@
<tr>
<td>
<label for="ai1ec_start-date-input">
- <?php _e( 'Start date / time', 'ai1ec' ); ?>:
+ <?php _e( 'Start date / time', AI1EC_PLUGIN_NAME ); ?>:
</label>
</td>
<td>
@@ -28,7 +28,7 @@
<tr>
<td>
<label for="ai1ec_end-date-input">
- <?php _e( 'End date / time', 'ai1ec' ) ?>:
+ <?php _e( 'End date / time', AI1EC_PLUGIN_NAME ) ?>:
</label>
</td>
<td>
@@ -41,7 +41,7 @@
<tr>
<td>
<label for="ai1ec_repeat">
- <?php _e( 'Repeat', 'ai1ec' ) ?>:
+ <?php _e( 'Repeat', AI1EC_PLUGIN_NAME ) ?>:
</label>
</td>
<td>
@@ -51,7 +51,7 @@
<tr id="ai1ec_end_holder" <?php if( ! $repeating_event ) echo 'class="ai1ec_hidden"' ?>>
<td>
<label for="ai1ec_end">
- <?php _e( 'End', 'ai1ec' ) ?>:
+ <?php _e( 'End', AI1EC_PLUGIN_NAME ) ?>:
</label>
</td>
<td>
@@ -61,7 +61,7 @@
<tr id="ai1ec_count_holder" <?php if( $ending != 1 ) echo 'class="ai1ec_hidden"' ?>>
<td>
<label for="ai1ec_count">
- <?php _e( 'Ending after', 'ai1ec' ) ?>:
+ <?php _e( 'Ending after', AI1EC_PLUGIN_NAME ) ?>:
</label>
</td>
<td>
@@ -71,7 +71,7 @@
<tr id="ai1ec_until_holder" <?php if( $ending != 2 ) echo 'class="ai1ec_hidden"' ?>>
<td>
<label for="ai1ec_until-date-input">
- <?php _e( 'On date', 'ai1ec' ) ?>:
+ <?php _e( 'On date', AI1EC_PLUGIN_NAME ) ?>:
</label>
</td>
<td>
diff -Naur all-in-one-event-calendar/app/view/month.php all-in-one-event-calendar-patched/app/view/month.php
--- all-in-one-event-calendar/app/view/month.php 2011-09-15 11:07:29.000000000 +0200
+++ all-in-one-event-calendar-patched/app/view/month.php 2011-09-20 13:51:33.296875000 +0200
@@ -1,7 +1,7 @@
<h2 class="ai1ec-calendar-title"><?php echo esc_html( $title ) ?></h2>
<span class="ai1ec-title-buttons">
<a id="ai1ec-today" class="ai1ec-load-view ai1ec-button" href="#action=ai1ec_month">
- <?php _e( 'Today', AI1EC_JS_URL ) ?>
+ <?php _e( 'Today', AI1EC_PLUGIN_NAME ) ?>
</a>
</span>
<ul class="ai1ec-pagination">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment