Changeset 498454
- Timestamp:
- 02/01/2012 10:53:18 AM (14 years ago)
- File:
-
- 1 edited
-
zeitansage/trunk/zeitansage.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
zeitansage/trunk/zeitansage.php
r497828 r498454 3 3 * Plugin Name: Zeitansage 4 4 * Plugin URI: http://www.gunnar-schmid.de/zeitansage 5 * Description: A widget to display the current time as verbal expression. Currently available in German only.5 * Description: A widget to display the current time as verbal expression. 6 6 * Author: Gunnar Schmid 7 * Version: 0. 1.07 * Version: 0.2.0 8 8 * Author URI: http://www.gunnar-schmid.de 9 9 * License: GPLv2 … … 11 11 12 12 add_action( 'widgets_init', 'pbr_load_widget' ); 13 $plugin_dir = basename( dirname( __FILE__) ); 14 load_plugin_textdomain( 'zeitansage', null, $plugin_dir ); 13 15 14 16 function pbr_load_widget() { … … 31 33 echo ' <input class="widefat" id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . esc_attr($title) . '" />'; 32 34 echo '</p>'; 33 34 /* language selection to come35 echo '<p>';36 echo ' <label for="' . $this->get_field_id( 'language' ) . '" >' . __( 'Language:' ) . '</label>';37 echo ' <select class="widefat" id="' . $this->get_field_id( 'language' ) . '" name="' . $this->get_field_name( 'language' ) . '">';38 echo ' <option ' . selected( $instance['language'], 'EN' ) . ' value="EN" >' . __( 'English' ) . '</option>';39 echo ' <option ' . selected( $instance['language'], 'DE' ) . ' value="DE" >' . __( 'German' ) . '</option>';40 echo ' </select>';41 echo '</p>';42 */43 35 } 44 36 … … 47 39 $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '') ); 48 40 $instance['title'] = strip_tags( $new_instance['title'] ); 49 /*50 if ( in_array( $new_instance['language'], array( 'EN', 'DE' ) ) ) {51 $instance['language'] = $new_instance['language'];52 } else {53 $instance['language'] = 'EN';54 }55 */56 41 return $instance; 57 42 } … … 80 65 $minute = round( $minute / 5 ) * 5; 81 66 82 // round up to next hour - CAUTION WHEN TRANSLATING: this works probably differently in other languages 83 if ( $minute >= 25 ) { 67 // round up to next hour 68 69 // TEMP: this should go into translations somehow 70 $roundup_to_next_hour = 35; 71 if ( substr( get_locale(), 0, 2 ) == 'de' ) { 72 $roundup_to_next_hour = 25; 73 } 74 75 if ( $minute >= $roundup_to_next_hour ) { 84 76 $hour++; 85 77 } … … 91 83 92 84 return sprintf( __( 'Es ist %1$s %2$s%3$s.' ), $minute_text, $hour_text, $oclock_text ); 93 //return 'Es ist jetzt ' . $minute_text . ' ' . $hour_text . $oclock_text . '.';94 85 } 95 86 … … 136 127 case 0: 137 128 case 60: 138 return __( '' );129 return ''; // note: no I18N for the empty string 139 130 case 5: 140 131 return __( 'fünf nach');
Note: See TracChangeset
for help on using the changeset viewer.