]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Make it possible for a program to load two different localizations, in
authorBruno Haible <bruno@clisp.org>
Tue, 1 Nov 2005 21:38:33 +0000 (21:38 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:12:56 +0000 (12:12 +0200)
the presence of a global assembly cache.

gettext-tools/src/ChangeLog
gettext-tools/src/write-csharp.c

index a9304c61c9989383e79455991b8136a5be6050a0..f928c36688268910eca5f7cdff1747703f16638f 100644 (file)
@@ -1,3 +1,10 @@
+2005-11-01  Bruno Haible  <bruno@clisp.org>
+
+       * write-csharp.c (write_csharp_code): Add culture_name argument.
+       Emit an AssemblyCulture note for it.
+       (msgdomain_write_csharp): Update.
+       Suggested by Pepa <cerna.zelva@seznam.cz>.
+
 2005-10-09  Bruno Haible  <bruno@clisp.org>
 
        * plural-eval.h: New file.
index 611879b19d417a33dac6058e47f7ee1729d7119f..47d1194d89c63991aa424f7b0cf6ca9fd06e4018 100644 (file)
@@ -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))
     {