Make WordPress Core

Opened 20 years ago

Closed 20 years ago

Last modified 22 months ago

#10 closed defect (bug) (fixed)

Can't localize days

Reported by: tomer's profile Tomer Owned by: ryan's profile ryan
Milestone: Priority: normal
Severity: trivial Version:
Component: Template Keywords:
Focuses: Cc:


I'm getting problems to localize day names.

#: wp-includes/locale.php:15
#: wp-includes/locale.php:21
msgid "S"
msgstr ""

We have the same string for Sunday and Saturday, which can't be translated while some languages have different short-name for those two distinct words.

Change History (11)

#2 @JasonV
20 years ago

Perhaps the single letter abbreviations ($weekday_initial) should be dynamically generated based on the (localized) full day names...

For example, instead of:

$weekday_initial[('Sunday')] = ('S');

we might have:

$weekday_initial[('Sunday')] = ('Sunday'){0};

#3 @Tomer
20 years ago

It is not the case here. In Hebrew, day names are "Rishon" (1st), "Sheni" (2nd), "Shlishi" (3rd) and so on, while the one-letter transformation for day names are "A", "B" and "C". All in Hebrew, of course.

#4 @JasonV
20 years ago

Interesting. Not as easy as I thought...

The first thing that comes to mind now is to use dummy text, such as this:

$weekday_initial[('Sunday')] = ('S_initial_for_Saturday'){0};
$weekday_initial[('Saturday')] = ('S_initial_for_Saturday'){0};

That would create unique text to be translated, as opposed to the current ('S'). Then for Hebrew you'd just have 'A_initial_for_Rishon', etc. But that may not be the best solution.

#5 @JasonV
20 years ago

  • Status changed from new to assigned

#6 @Tomer
20 years ago

Still, other languages might have another problems with this - what if specific language has no one-letter day names at all? I don't know such language, but it might be.

#7 @ryan
20 years ago

I'll probably use the dummy text workaround. For now, you can use the three letter abreviation instead of the initial by calling get_calendar(3). The three letter abbrevs can be uniquely translated. By the way, we can't use subscripting because php is not multibyte aware.

#8 @ryan
20 years ago

  • Owner changed from anonymous to rboren

#9 @ryan
20 years ago

  • Resolution changed from 10 to 20
  • Status changed from assigned to closed

This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.

10 years ago

Note: See TracTickets for help on using tickets.