home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Freeware / Miro 1.0 / Miro_Installer.exe / resources / locale / build-catalogs.py < prev    next >
Encoding:
Python Source  |  2007-11-12  |  3.0 KB  |  91 lines

  1. import glob
  2. import os.path
  3. import os
  4.  
  5. os.system("python fix-ro-plurals.py")
  6.  
  7. for pofile in glob.glob ("*.po"):
  8.     lang = pofile[:-3]
  9.     mofile = os.path.join ("%s.mo" % lang)
  10.     os.system ("msgfmt %s -o %s" % (pofile, mofile))
  11.  
  12. for dtd in glob.glob ("../../platform/windows-xul/xul/chrome/locale/en-US/*.dtd.template"):
  13.     dtd = os.path.basename (dtd)
  14.     os.system ("(cd ../../platform/windows-xul/xul/chrome/locale/; intltool-merge --quoted-style -m ../../../../../resources/locale/ en-US/%s %s)" % (dtd, dtd))
  15.     os.system ("(cd ../../platform/windows-xul/xul/chrome/locale/; perl -pi -e 's/\\\\\\\"/"/g' */%s)" % (dtd,))
  16.  
  17.  
  18. # Let's use xgettext for this since it supports string tables.
  19. langs = (
  20.          ("ar", "Arabic"),
  21.          ("bg", "Bulgarian"),
  22.          ("br", "Breton"),
  23.          ("bs", "Bosnian"),
  24.          ("ca", "Catalan"),
  25.          ("cs", "Czech"),
  26.          ("cy", "Welsh"),
  27.          ("da", "Danish"),
  28.          ("de", "German"),
  29.          ("el", "Greek"),
  30.          ("en_AU", "English_Australian"),
  31.          ("en_GB", "English_British"),
  32.          ("eo", "Esperanto"),
  33.          ("es", "Spanish"),
  34.          ("et", "Estonian"),
  35.          ("eu", "Basque"),
  36.          ("fa", "Persian"),
  37.          ("fi", "Finnish"),
  38.          ("fil", "Filipino"),
  39.          ("fo", "Faroese"),
  40.          ("fr", "French"),
  41.          ("fy", "Frisian"),
  42.          ("gl", "Gallegan"),
  43.          ("gu", "Gujarati"),
  44.          ("he", "Hebrew"),
  45.          ("hi", "Hindi"),
  46.          ("hr", "Croatian"),
  47.          ("hu", "Hungarian"),
  48.          ("id", "Indonesian"),
  49.          ("is", "Icelandic"),
  50.          ("it", "Italian"),
  51.          ("ja", "Japanese"),
  52.          ("ka", "Georgian"),
  53.          ("ko", "Korean"),
  54.          ("ku", "Kurdish"),
  55.          ("lt", "Lithuanian"),
  56.          ("lv", "Latvian"),
  57.          ("mk", "Macedonian"),
  58.          ("ml", "Malayalam"),
  59.          ("mr", "Marathi"),
  60.          ("ms", "Malay"),
  61.          ("nb", "Norwegian"),
  62.          ("nl", "Dutch"),
  63.          ("nn", "Norwegian_Nynorsk"),
  64.          ("pa", "Punjabi"),
  65.          ("pl", "Polish"),
  66.          ("pt", "Portuguese"),
  67.          ("pt_BR", "Portuguese_Brazilian"),
  68.          ("ro", "Romanian"),
  69.          ("ru", "Russian"),
  70.          ("sk", "Slovak"),
  71.          ("sl", "Slovenian"),
  72.          ("sq", "Albanian"),
  73.          ("sr", "Serbian"),
  74.          ("sv", "Swedish"),
  75.          ("te", "Telugu"),
  76.          ("th", "Thai"),
  77.          ("tl", "Tagalog"),
  78.          ("tr", "Turkish"),
  79.          ("vi", "Vietnamese"),
  80.          ("zh_CN", "Chinese_Simplified"),
  81.          ("zh_HK", "Chinese_HK"),
  82.          ("zh_TW", "Chinese_Traditional"),
  83.          )
  84. for lang in langs:
  85.     try:
  86.         os.makedirs ("../../platform/osx/Resources/%s.lproj" % (lang[1],))
  87.     except:
  88.         pass
  89.     # The perl statement removes po entries that have plurals in them since xgettext gives an error on those when writing a stringtable.
  90.     os.system ( "cat %s.po | perl -e '$/=\"\"; while (<>) {print if !/msgid_plural/;}' | xgettext --force -o ../../platform/osx/Resources/%s.lproj/translated.strings --stringtable-output - -L PO" % (lang[0], lang[1]))
  91.