[Freeciv-Dev] Re: (PR#2374) multi-language client-server patch
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, Nov 21, 2002 at 04:30:49AM -0800, Per I. Mathisen via RT wrote:
>
> On Wed, 20 Nov 2002, mateusz stefek via RT wrote:
> > See incoming/fims.tgz
> >
> > I've spent many hours writing and testing it, so have fun
>
> Please describe what it is.
From the patch:
+/*
+ The FIMS system (Freeciv Internationalized Message System)
+ == introducion ==
+
+ The FIMS system is used to pack an untraslated expression into
+ a machine-independent buffer, which could be later unpacked and
+ translated.
+
+ Mechanizm is intended to be very simple:
+ 1) Server calls serialize_fims(data_out, format, args)
+ Where format is something similiar to printf-format and
+ following args are used as in vprintf,
+ 2) The serialize_fims writes on some buffer
+ using data_out structure (dataio),
+ 3) Server somehow sends this buffer to the client,
+ 4) Client receives the buffer and calls
+ get_and_translate_fims(struct data_in * din, char *out)
+ 5) The translated string sits in out
+
+ == fims format ==
+
+ It works just like printf, but instead of '%' it uses
+ '^' (We don't want to confuse msgfmt).
+ Directives available:
+ s - the string which will be translated
+ e - the string which will stay unchanged
+ u - unit type (the argument is Unit_Type_id) which will be
+ replaced with its translated name.
+ l - There are 2 arg: (x, y) which
+ will be replaced with
+ get_location_str_in(x, y)
+ L - There are 2 arg: (x, y) which
+ will be replaced with
+ get_location_str_at(x, y)
+ p - There are 3 args (string1, string2, int n) which
+ will be replaced with PL_(string1, string2, n)
+ This is a recursive directive.
+ n - the Nation_Type_id, which will be replaced with get_nation_name
+ N - the Nation_Type_id, which will be replaced with get_nation_name_plural
+ i - There are 2 args (int city_no, Impr_Type_id) which will be replaced
+ with get_impr_name_ex(). (get_impr_name_ex sometimes returns
"(obsolete)" note)
+ I - Impr_Type_id will be replaced with get_improvement_name()
+ t - Tech_type_id will be replaced with it's name
+ g - government id will be replaced with get_government_name()
+
+ Some correct examples:
+ N_("Hello there")
+ N_("The city ^e may soon grow to size ^d"), city.name, size
+ N_("You lost ^u ^l"), get_unit_type(punit), x, y
+ N_("You are the ^s), loser? N_("loser") : N_("winner")
+
+ To change the order of directives you should write a number
+ beetween '^' and the directive. For example:
+ "^2l ^1s", string, x, y
+ is correct.
+ But When you use digit after one '^' you should use it everywhere
+ "^2s ^1s ^d" is incorrect
+
+ == rekursive directives ==
+
+ String which is returned by a recursive directive is treated as another
+ format. Argument for it should be __after__ another arguments.
+ I.E:
+ N_("^p because ^s"),
+ NPL_("You lost ^d unit", "You lost ^d units", count),
+ N_("something has happened"),
+ count);
+
+ There is only one level of recursion allowed.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"The Internet is really just a series of bottlenecks
joined by high speed networks."
-- Sam Wilson
|
|