patchFreeciv - Patches: patch #3028, Uppercasing of first letter of...

 
 
Show feedback again

patch #3028: Uppercasing of first letter of notify messages

Submitted by:  Marko Lindqvist <cazfi>
Submitted on:  Mon 07 Nov 2011 12:08:41 AM UTC  
 
Category: generalPriority: 5 - Normal
Status: DonePrivacy: Public
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Planned Release: 2.4.0, 2.5.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Mon 25 Mar 2013 09:53:28 PM UTC, SVN revision 22597:

Uppercase first letter of notify messages if current locale is Finnish.

See patch #3028

(Browse SVN revision 22597)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 25 Mar 2013 09:53:22 PM UTC, SVN revision 22596:

Uppercase first letter of notify messages if current locale is Finnish.

See patch #3028

(Browse SVN revision 22596)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 18 Mar 2013 09:55:11 PM UTC, comment #7:

Reused from old patch:
- Actual uppercasing functionality
- Selection of languages to have uppercasing enabled

There's no gettext-like macro, but all notify messages are feeded to uppercasing once constructed.

(file #17447)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 17 Mar 2013 11:05:43 PM UTC, comment #6:

This patch goes nowhere in resolving the uppercasing problem. It does uppercasing of the translated format string, so in the very case translator cannot uppercase her/himself, i.e., when the (translated) format string begins with "%s", subject to uppercasing is character "%". There's no way to cause uppercasing of the parameter string at this level (before the actual string has been constructed from format and parameters).

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Wed 09 Nov 2011 10:39:11 PM UTC, comment #5:

> Ah so this isn't so much about forcing an uppercase but rather
> forcing a lowercase in the middle of a sentence?


Turning it that way around works in logic, but unfortunately I don't think it's technically feasible to implement that way. Oh, and I think it would cause problems with all western languages if there ever happens to be units with names of individuals (such as "Leader" units named after leader of the nation) THose should not be lowercased even in the middle of the sentence.

Anyway, as you see in comment #3, I improved the patch so that now capitalization is not forced to all translations, but you (translators) can opt your translation in. Obviously Gaelic should not be opted in. Well see if this code exist for Finnish translation only. ;-)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Wed 09 Nov 2011 10:18:31 PM UTC, comment #4:

Ah so this isn't so much about forcing an uppercase but rather forcing a lowercase in the middle of a sentence? So that something like
Mountains
becomes
Your engineers have converted this terrain to mountains

Is that it? That way round, it shouldn't be a problem for Gaelic, we use lowercase throughout anyway except for names.

Michael Bauer <akerbeltz>
Project Member
Mon 07 Nov 2011 08:10:03 PM UTC, comment #3:

- Capitalization happens only if current language is in list translators can opt-in their language.

It's all-or-nothing for now. One your language has "subscribed" to autocapitalization, it will get it for all strings marked with C_() I already have long term plans to make that string-dependant, so you can have capitalization for unit names in the beginning of sentence, but still not capitalize when unit in question happens to be "van Helsing"

(file #14466)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 07 Nov 2011 12:36:11 AM UTC, comment #2:

I'm not certain I totally understand the meaning of the suggested change but in Irish and Gaelic usually anything that forces uppercase initials is a terrible idea because we have words with obligatory lowercase initial irrespective of where they appear (e.g. h-Ăˆireann, h-ĂˆIREANN, t-aran, t-ARAN).

Michael Bauer <akerbeltz>
Project Member
Mon 07 Nov 2011 12:17:17 AM UTC, comment #1:

I don't believe in wide use of C_(). Instead my idea is that translators request it to be used in some specific cases that are hard to resolve otherwise. Coders probably should not use it unless that way requested. (We may need to clean up all those uses when better solution for automatic uppercasing becomes available)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 07 Nov 2011 12:08:41 AM UTC, original submission:

We sometimes want to have same translation to appear with lowercase first letter in some places, and uppercase first letter in other places. patch #3027 may eventually lead to good solution for this, but here's quick hack for urgent short-term (2.4, 2.3?) needs.

It introduces new macro C_() that returns string with first character uppercased in some cases. It works only if that said first character is 7-bit ascii character (single-byte UTF-8 character) This is not completely useless, as translators still control what word they push there. If all unit names in their translation start with ascii-character, they can put them via "%s" to the beginning of this kind of string. If some unit name does not begin with ascii-character, they cannot put it to the beginning, but neither were they able to do so before.

Note that unlike other xx_() macros, this does not return same statically allocated constant string for all identical calls, but returned string is constructed for each call. For this reason it has to be also freed with separate function call when string is no longer needed.

Uppercasing any other characters than first one in UTF-8 text would be hard, even if that particular character itself is ascii one. Since characters before it are variable width, it's not easy to tell which bytes belong to which character (or even if certain byte looking like ascii character is indeed ascii character or latter part of multibyte character)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #17447:  CapFiNotify.patch added by cazfi (6kB - text/x-diff)
file #14466:  C_macro_3028-2.diff added by cazfi (4kB - text/plain)
file #14460:  C_macro.diff added by cazfi (3kB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by cazfi
  • -unavailable- added by akerbeltz (Posted a comment)
  • -unavailable- added by cazfi (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.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 12 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 25 Mar 2013 09:53:43 PM UTCcazfiStatusReady For Test=>Done
      Open/ClosedOpen=>Closed
    Mon 18 Mar 2013 09:55:11 PM UTCcazfiAttached File-=>Added CapFiNotify.patch, #17447
      StatusInvalid=>Ready For Test
      Open/ClosedClosed=>Open
      SummaryMacro to uppercase first letter of string=>Uppercasing of first letter of notify messages
    Sun 17 Mar 2013 11:05:43 PM UTCcazfiStatusReady For Test=>Invalid
      Assigned toNone=>cazfi
      Open/ClosedOpen=>Closed
    Mon 07 Nov 2011 08:10:03 PM UTCcazfiCarbon-Copy-=>Added -unavailable-
    Mon 07 Nov 2011 08:10:02 PM UTCcazfiAttached File-=>Added C_macro_3028-2.diff, #14466
    Mon 07 Nov 2011 12:08:41 AM UTCcazfiAttached File-=>Added C_macro.diff, #14460
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup