patchBattle for Wesnoth - Patches: patch #3777, Add a way to translate months,...

Show feedback again

patch #3777: Add a way to translate months, weekdays and AM/PM

Submitted by:  Andrius Silinskas <thunderstruck>
Submitted on:  Tue Mar 12 11:01:34 2013  
Priority: 5 - NormalStatus: Done
Privacy: PublicAssigned to: Mark de Wever <mordante>
Open/Closed: Closed

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Fri Mar 29 21:44:38 2013, comment #2:

Different approach was taken to fix/avoid issues mordante noticed:
An strftime function with translatable date info was written to be used as a fallback if the requested locale is missing. The new strftime works like the original strftime except that it is independent from the locales on the machine and uses translatable strings. Also undocumented behaviour (misuse) of the original strftime might not always match the fallback strftime's behaviour.

(file #17603)

Andrius Silinskas <thunderstruck>
Project Member
Wed Mar 13 20:53:11 2013, comment #1:

Some notes I also left in IRC
- what would happen if in language x Saturday is translated as Sunny?
- strcpy is evil do not use it, especially not when the function signature has a maxsize parameter.
- the std::setlocale on line 342 is not done exception safe regarding restoring it, the return on line 351 also will leave us with a modified locale.
- I'm still not sure whether the approach of this patch is the right way. Also not sure whether we want to add extra strings for translators.

Mark de Wever <mordante>
Project MemberIn charge of this item.
Tue Mar 12 11:01:34 2013, original submission:

Implemented a function wesnoth_strftime and changed calls to strftime with wesnoth_strftime where appropriate. wesnoth_strftime checks if correct time locale in use and acts accordingly: if correct just use strftime to format date, if not also apply gettext to months, weekdays and AM/PM.

Partially fixes bug (AM/PM still won't be displayed if locale in use is correct, but don't support AM/PM).

Andrius Silinskas <thunderstruck>
Project Member


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by mordante (Posted a comment)
  • -unavailable- added by espreon (Updated the item)
  • -unavailable- added by thunderstruck (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat Mar 8 14:16:53 2014thunderstruckStatusNone=>Done
    Fri Mar 29 21:44:38 2013thunderstruckAttached File-=>Added date_translations2.patch, #17603
    Tue Mar 12 19:30:06 2013espreonAssigned toNone=>mordante
    Tue Mar 12 11:01:34 2013thunderstruckAttached File-=>Added date_translations.patch, #17423
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup