r517 - trunk/misc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Feb 28 06:34:34 EST 2008


Author: icculus
Date: 2008-02-28 06:34:34 -0500 (Thu, 28 Feb 2008)
New Revision: 517

Added:
   trunk/misc/poize.lua
Log:
Quick and dirty Lua script so I can dump the existing translations into .po
 files and upload them to launchpad.net.


Added: trunk/misc/poize.lua
===================================================================
--- trunk/misc/poize.lua	                        (rev 0)
+++ trunk/misc/poize.lua	2008-02-28 11:34:34 UTC (rev 517)
@@ -0,0 +1,96 @@
+MojoSetup = {}
+assert(loadfile('scripts/localization.lua'))()
+
+locale = 'de_DE';
+lang = 'de';
+langformal = 'German';
+
+print([[
+# MojoSetup; a portable, flexible installation application.
+#    http://icculus.org/mojosetup/
+#
+# Please see the file LICENSE.txt in the source's root directory.
+#
+# This file generated by poize.pl, version $svnver ...
+#
+#
+# NOTE: If you care about Unicode or ASCII chars above 127, this file _MUST_
+#  be UTF-8 encoded! If you think you're using a certain high-ascii codepage,
+#  you're wrong!
+#
+# Whenever you see a %x sequence, that is replaced with a string at runtime.
+#  So if you see, "Hello, %0, my name is %1.", then this might become
+#  "Hello, Alice, my name is Bob." at runtime. If your culture would find
+#  introducing yourself second to be rude, you might translate this to:
+#  "My name is %1, hello %0." If you need a literal '%' char, write "%%":
+#  "Operation is %0%% complete" might give "Operation is 3% complete."
+#  All strings, from your locale or otherwise, are checked for formatter
+#  correctness at startup. This is to prevent the installer working fine
+#  in all reasonable tests, then finding out that one guy in Ghana has a
+#  crashing installer because his localization forgot to add a %1 somewhere.
+#
+# Occasionally you might see a "\\n" ... that's a newline character. "\\t" is
+#  a tab character, and "\\\\" turns into a single "\\" character.
+#
+# Questions about the intent of a specific string can go to Ryan C. Gordon
+#  (icculus\@icculus.org).
+
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: mojosetup\\n"
+"Report-Msgid-Bugs-To: icculus at icculus.org\\n"
+"POT-Creation-Date: 2008-02-28 04:26:12-0500\\n"
+"PO-Revision-Date: $now\\n"
+"Last-Translator: Ryan C. Gordon <icculus at icculus.org>\\n"]])
+
+print('"Language-Team: ' .. langformal .. ' <' .. lang .. '@li.org>\\n"')
+
+print([["MIME-Version: 1.0\\n"
+"Content-Type: text/plain; charset=UTF-8\\n"
+"Content-Transfer-Encoding: 8bit\\n"
+
+]])
+
+    if MojoSetup.localization ~= nil then
+        local at_least_one = false
+
+        MojoSetup.translations = {}
+        for k,v in pairs(MojoSetup.localization) do
+            if MojoSetup.translations[k] ~= nil then
+                error("BUG: Duplicate localization key ['" .. k .. "']")
+            end
+            if type(v) == "table" then
+                if v[locale] ~= nil then
+                    MojoSetup.translations[k] = v[locale]
+                    at_least_one = true
+                elseif v[lang] ~= nil then
+                    MojoSetup.translations[k] = v[lang]
+                    at_least_one = true
+                end
+            end
+        end
+
+        -- Delete the table if there's no actual useful translations for this run.
+        if (not at_least_one) then
+            MojoSetup.translations = nil
+        end
+
+        -- This is eligible for garbage collection now. We're done with it.
+        MojoSetup.localization = nil
+    end
+
+if MojoSetup.translations ~= nil then
+    for k,v in pairs(MojoSetup.translations) do
+	local ksub = string.gsub(k, "\n", "\\n")
+	local vsub = string.gsub(v, "\n", "\\n")
+        print('msgid "' .. ksub .. '"')
+        print('msgstr "' .. vsub .. '"')
+        print('')
+    end
+end
+
+print('end of localization-' .. lang .. '.po ...')
+print('')
+print('')
+




More information about the mojosetup-commits mailing list