URL:
  <http://gna.org/patch/?3028>

                 Summary: Macro to uppercase first letter of string
                 Project: Freeciv
            Submitted by: cazfi
            Submitted on: Mon 07 Nov 2011 02:08:41 AM EET
                Category: general
                Priority: 5 - Normal
                  Status: Ready For Test
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 2.4.0, 2.5.0

    _______________________________________________________

Details:

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)



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 07 Nov 2011 02:08:41 AM EET  Name: C_macro.diff  Size: 3kB   By:
cazfi

<http://gna.org/patch/download.php?file_id=14460>

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?3028>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to