From: Bruno Haible Date: Tue, 1 Nov 2005 21:38:33 +0000 (+0000) Subject: Make it possible for a program to load two different localizations, in X-Git-Tag: v0.15~347 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0a84446ea5da0b7bbc246081aba0b0024ac24f6;p=thirdparty%2Fgettext.git Make it possible for a program to load two different localizations, in the presence of a global assembly cache. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index a9304c61c..f928c3668 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,10 @@ +2005-11-01 Bruno Haible + + * write-csharp.c (write_csharp_code): Add culture_name argument. + Emit an AssemblyCulture note for it. + (msgdomain_write_csharp): Update. + Suggested by Pepa . + 2005-10-09 Bruno Haible * plural-eval.h: New file. diff --git a/gettext-tools/src/write-csharp.c b/gettext-tools/src/write-csharp.c index 611879b19..47d1194d8 100644 --- a/gettext-tools/src/write-csharp.c +++ b/gettext-tools/src/write-csharp.c @@ -484,7 +484,7 @@ write_csharp_expression (FILE *stream, struct expression *exp, bool as_boolean) because applications can have their own classes called X.Y.Hashtable or X.Y.String. */ static void -write_csharp_code (FILE *stream, const char *class_name, message_list_ty *mlp) +write_csharp_code (FILE *stream, const char *culture_name, const char *class_name, message_list_ty *mlp) { const char *last_dot; const char *class_name_last_part; @@ -493,9 +493,18 @@ write_csharp_code (FILE *stream, const char *class_name, message_list_ty *mlp) fprintf (stream, "/* Automatically generated by GNU msgfmt. Do not modify! */\n"); + /* We have to use a "using" statement here, to avoid a bug in the pnet-0.6.0 compiler. */ fprintf (stream, "using GNU.Gettext;\n"); + + /* Assign a strong name to the assembly, so that two different localizations + of the same domain can be loaded one after the other. This strong name + tells the Global Assembly Cache that they are meant to be different. */ + fprintf (stream, "[assembly: System.Reflection.AssemblyCulture("); + write_csharp_string (stream, culture_name); + fprintf (stream, ")]\n"); + last_dot = strrchr (class_name, '.'); if (last_dot != NULL) { @@ -782,7 +791,7 @@ but the C# .dll format doesn't support contexts\n"))); goto quit4; } - write_csharp_code (csharp_file, class_name, mlp); + write_csharp_code (csharp_file, culture_name, class_name, mlp); if (fwriteerror (csharp_file)) {