Extending WP_Locale
-
Hello,
I am trying to add a custom abbreviation to WP_Locale. Basically, I just want it to display ‘Th’ for Thursday when using the weekday initials. I know I can just edit the wp-includes/locale.php file. I don’t want to do that. I am just trying to extend the class using a plugin, and not touch the WP core. Do I use apply_filters()? add_action()? I just want to do something like:
$wp_locale->my_weekday_initial[__(‘Sunday’)] = /* translators: one-letter abbreviation of the weekday */ __(‘S_Sunday_initial’);
$wp_locale->my_weekday_initial[__(‘Monday’)] = /* translators: one-letter abbreviation of the weekday */ __(‘M_Monday_initial’);
$wp_locale->my_weekday_initial[__(‘Tuesday’)] = /* translators: one-letter abbreviation of the weekday */ __(‘T_Tuesday_initial’);
$wp_locale->my_weekday_initial[__(‘Wednesday’)] = /* translators: one-letter abbreviation of the weekday */ __(‘W_Wednesday_initial’);
$wp_locale->my_weekday_initial[__(‘Thursday’)] = /* translators: one-letter abbreviation of the weekday */ __(‘Th_Thursday_initial’);
$wp_locale->my_weekday_initial[__(‘Friday’)] = /* translators: one-letter abbreviation of the weekday */ __(‘F_Friday_initial’);
$wp_locale->my_weekday_initial[__(‘Saturday’)] = /* translators: one-letter abbreviation of the weekday */ __(‘S_Saturday_initial’);I know this is extremely trivial and perhaps a waste of time. But I’m really trying to solidifying my WordPress core understanding…
Why does the locale.php file use the __(‘Saturday’) stuff? is __() a real function?
Please help fill in the holes of my understanding
- The topic ‘Extending WP_Locale’ is closed to new replies.