dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/I18N/tools cvtcul.sh,1.1,1.2 loc2cul


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/I18N/tools cvtcul.sh,1.1,1.2 loc2cul.c,1.1,1.2
Date: Sun, 01 Jun 2003 20:59:02 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/I18N/tools
In directory subversions:/tmp/cvs-serv4874/I18N/tools

Modified Files:
        cvtcul.sh loc2cul.c 
Log Message:


Add support for DisplayName, EnglishName, and NativeName, based on the
information in the locale files; move the English locales into
"I18N.dll" to support EnglishName.


Index: cvtcul.sh
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/I18N/tools/cvtcul.sh,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** cvtcul.sh   1 Jun 2003 07:12:56 -0000       1.1
--- cvtcul.sh   2 Jun 2003 00:59:00 -0000       1.2
***************
*** 165,197 ****
  # English
  
! ${LOC2CUL} --region West --id 0x0009 --name en \
!       West/en.txt >West/CID0009.cs
  
! ${LOC2CUL} --region West --id 0x0C09 --name en-AU \
!       West/en_AU.txt >West/CID0c09.cs
  
! ${LOC2CUL} --region West --id 0x1009 --name en-CA \
!       West/en_CA.txt >West/CID1009.cs
  
! ${LOC2CUL} --region West --id 0x0809 --name en-GB \
!       West/en_GB.txt >West/CID0809.cs
  
! ${LOC2CUL} --region West --id 0x1809 --name en-IE \
!       West/en_IE.txt >West/CID1809.cs
  
! ${LOC2CUL} --region West --id 0x1409 --name en-NZ \
!       West/en_NZ.txt >West/CID1409.cs
  
! ${LOC2CUL} --region West --id 0x3409 --name en-PH \
!       West/en_PH.txt >West/CID3409.cs
  
! ${LOC2CUL} --region West --id 0x0409 --name en-US \
!       West/en_US.txt >West/CID0409.cs
  
! ${LOC2CUL} --region West --id 0x1C09 --name en-ZA \
!       West/en_ZA.txt >West/CID1c09.cs
  
! ${LOC2CUL} --region West --id 0x3009 --name en-ZW \
!       West/en_ZW.txt >West/CID3009.cs
  
  # Spanish
--- 165,197 ----
  # English
  
! ${LOC2CUL} --region Common --id 0x0009 --name en \
!       Common/en.txt >Common/CID0009.cs
  
! ${LOC2CUL} --region Common --id 0x0C09 --name en-AU \
!       Common/en_AU.txt >Common/CID0c09.cs
  
! ${LOC2CUL} --region Common --id 0x1009 --name en-CA \
!       Common/en_CA.txt >Common/CID1009.cs
  
! ${LOC2CUL} --region Common --id 0x0809 --name en-GB \
!       Common/en_GB.txt >Common/CID0809.cs
  
! ${LOC2CUL} --region Common --id 0x1809 --name en-IE \
!       Common/en_IE.txt >Common/CID1809.cs
  
! ${LOC2CUL} --region Common --id 0x1409 --name en-NZ \
!       Common/en_NZ.txt >Common/CID1409.cs
  
! ${LOC2CUL} --region Common --id 0x3409 --name en-PH \
!       Common/en_PH.txt >Common/CID3409.cs
  
! ${LOC2CUL} --region Common --id 0x0409 --name en-US \
!       Common/en_US.txt >Common/CID0409.cs
  
! ${LOC2CUL} --region Common --id 0x1C09 --name en-ZA \
!       Common/en_ZA.txt >Common/CID1c09.cs
  
! ${LOC2CUL} --region Common --id 0x3009 --name en-ZW \
!       Common/en_ZW.txt >Common/CID3009.cs
  
  # Spanish

Index: loc2cul.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/I18N/tools/loc2cul.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** loc2cul.c   1 Jun 2003 07:12:56 -0000       1.1
--- loc2cul.c   2 Jun 2003 00:59:00 -0000       1.2
***************
*** 567,571 ****
                   definition, and that it should not attempt to recursively
                   load the culture again */
!               printf("public class RootCulture : CultureInfo\n{\n", 
identifier);
                printf("\tprivate CultureName cultureName;\n\n");
                printf("\tpublic RootCulture(int culture, CultureName 
cultureName)\n");
--- 567,571 ----
                   definition, and that it should not attempt to recursively
                   load the culture again */
!               printf("public abstract class RootCulture : CultureInfo\n{\n");
                printf("\tprivate CultureName cultureName;\n\n");
                printf("\tpublic RootCulture(int culture, CultureName 
cultureName)\n");
***************
*** 576,584 ****
  
                /* Override the name properties */
                printf("\tpublic override String EnglishName\n");
                printf("\t{\n");
                printf("\t\tget\n");
                printf("\t\t{\n");
!               printf("\t\t\treturn cultureName.englishName;\n");
                printf("\t\t}\n");
                printf("\t}\n");
--- 576,591 ----
  
                /* Override the name properties */
+               printf("\tpublic override String DisplayName\n");
+               printf("\t{\n");
+               printf("\t\tget\n");
+               printf("\t\t{\n");
+               printf("\t\t\treturn Manager.GetDisplayName(this);\n");
+               printf("\t\t}\n");
+               printf("\t}\n");
                printf("\tpublic override String EnglishName\n");
                printf("\t{\n");
                printf("\t\tget\n");
                printf("\t\t{\n");
!               printf("\t\t\treturn Manager.GetEnglishName(this);\n");
                printf("\t\t}\n");
                printf("\t}\n");
***************
*** 594,598 ****
                printf("\t\tget\n");
                printf("\t\t{\n");
!               printf("\t\t\treturn cultureName.nativeName;\n");
                printf("\t\t}\n");
                printf("\t}\n");
--- 601,605 ----
                printf("\t\tget\n");
                printf("\t\t{\n");
!               printf("\t\t\treturn Manager.GetNativeName(this);\n");
                printf("\t\t}\n");
                printf("\t}\n");
***************
*** 618,621 ****
--- 625,638 ----
                printf("\t\t}\n");
                printf("\t}\n\n");
+ 
+               /* Declare the "Language" and "Country" properties for the root 
*/
+               printf("\tpublic abstract String Language { get; }\n");
+               printf("\tpublic virtual String Country\n");
+               printf("\t{\n");
+               printf("\t\tget\n");
+               printf("\t\t{\n");
+               printf("\t\t\treturn null;\n");
+               printf("\t\t}\n");
+               printf("\t}\n\n");
        }
        else if((identifier & 0x03FF) == identifier)
***************
*** 643,646 ****
--- 660,685 ----
                           identifier, identifier);
        }
+       if(identifier != 0)
+       {
+               /* Declare the "Language" and "Country" properties for a 
culture */
+               printf("\tpublic override String Language\n");
+               printf("\t{\n");
+               printf("\t\tget\n");
+               printf("\t\t{\n");
+               printf("\t\t\treturn \"%c%c\";\n", name[0], name[1]);
+               printf("\t\t}\n");
+               printf("\t}\n");
+               if(strlen(name) > 2)
+               {
+                       printf("\tpublic override String Country\n");
+                       printf("\t{\n");
+                       printf("\t\tget\n");
+                       printf("\t\t{\n");
+                       printf("\t\t\treturn \"%c%c\";\n", name[3], name[4]);
+                       printf("\t\t}\n");
+                       printf("\t}\n");
+               }
+               printf("\n");
+       }
  }
  
***************
*** 1166,1169 ****
--- 1205,1296 ----
  
  /*
+  * Print the language name resolvers.
+  */
+ static void printLanguageResolvers(void)
+ {
+       Node *langs = getNode("Languages");
+       Node *countries = getNode("Countries");
+       Node *child;
+ 
+       /* Bail out if no language or country names are defined for this 
culture */
+       if(!langs && !countries)
+       {
+               return;
+       }
+ 
+       /* Create the language resolver method */
+       if(langs)
+       {
+               if(!identifier)
+               {
+                       printf("\tpublic virtual String ResolveLanguage(String 
name)\n");
+               }
+               else
+               {
+                       printf("\tpublic override String ResolveLanguage(String 
name)\n");
+               }
+               printf("\t{\n");
+               printf("\t\tswitch(name)\n");
+               printf("\t\t{\n");
+               child = langs->children;
+               while(child != 0)
+               {
+                       if(child->children)
+                       {
+                               printf("\t\t\tcase \"%s\": return \"%s\";\n",
+                                          child->name, child->children->name);
+                       }
+                       child = child->next;
+               }
+               printf("\t\t}\n");
+               if(!identifier)
+               {
+                       printf("\t\treturn name;\n");
+               }
+               else
+               {
+                       printf("\t\treturn base.ResolveLanguage(name);\n");
+               }
+               printf("\t}\n\n");
+       }
+ 
+       /* Create the country resolver method */
+       if(countries)
+       {
+               if(!identifier)
+               {
+                       printf("\tpublic virtual String ResolveCountry(String 
name)\n");
+               }
+               else
+               {
+                       printf("\tpublic override String ResolveCountry(String 
name)\n");
+               }
+               printf("\t{\n");
+               printf("\t\tswitch(name)\n");
+               printf("\t\t{\n");
+               child = countries->children;
+               while(child != 0)
+               {
+                       if(child->children)
+                       {
+                               printf("\t\t\tcase \"%s\": return \"%s\";\n",
+                                          child->name, child->children->name);
+                       }
+                       child = child->next;
+               }
+               printf("\t\t}\n");
+               if(!identifier)
+               {
+                       printf("\t\treturn name;\n");
+               }
+               else
+               {
+                       printf("\t\treturn base.ResolveCountry(name);\n");
+               }
+               printf("\t}\n\n");
+       }
+ }
+ 
+ /*
   * Print the definition of the culture, using the loaded locale rules.
   */
***************
*** 1172,1174 ****
--- 1299,1302 ----
        printDateTimeFormat();
        printNumberFormat();
+       printLanguageResolvers();
  }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]