compiler/i18n: Modified .bowl/.pot generation to always use '/' for paths, so as...
[sdk] / compiler / ecs / ecs.ec
index 3c217eb..1e5c755 100644 (file)
@@ -1727,6 +1727,9 @@ class SymbolgenApp : Application
 
          //if(!strcmp(ext, "c"))
          {
+            String symbolsDir = GetSymbolsDir();
+            // Only generating .pot files when building from release.* directory for now
+            bool outputPot = symbolsDir && SearchString(symbolsDir, 0, "release.", false, false);
             Map<ContextStringPair, List<String> > intlStrings { };
             MapIterator<ContextStringPair, List<String>> it { map = intlStrings };
 
@@ -1905,7 +1908,7 @@ class SymbolgenApp : Application
             }
             WriteMain(output);
 
-            if(intlStrings.count)
+            if(outputPot && intlStrings.count)
             {
                File potFile;
                char potFileName[MAX_LOCATION];
@@ -1918,6 +1921,20 @@ class SymbolgenApp : Application
                potFile = FileOpen(potFileName, write);
                if(potFile)
                {
+                  // Write header:
+                  potFile.Puts("msgid \"\"\n");
+                  potFile.Puts("msgstr \"\"\n");
+                  potFile.Puts("\"Project-Id-Version: \\n\"\n");
+                  potFile.Puts("\"POT-Creation-Date: \\n\"\n");
+                  potFile.Puts("\"PO-Revision-Date: \\n\"\n");
+                  potFile.Puts("\"Last-Translator: \\n\"\n");
+                  potFile.Puts("\"Language-Team: \\n\"\n");
+                  potFile.Puts("\"MIME-Version: 1.0\\n\"\n");
+                  potFile.Puts("\"Content-Type: text/plain; charset=iso-8859-1\\n\"\n");
+                  potFile.Puts("\"Content-Transfer-Encoding: 8bit\\n\"\n");
+                  potFile.Puts("\"X-Poedit-Basepath: ../\\n\"\n");
+                  potFile.Puts("\n");
+
                   for(i : intlStrings)
                   {
                      ContextStringPair pair = &i;
@@ -1928,11 +1945,11 @@ class SymbolgenApp : Application
                         potFile.Puts("\n");
                      }
 
-                     potFile.Puts("msgid \""); potFile.Puts(pair.string); potFile.Puts("\"\n");
                      if(pair.context)
                      {
                         potFile.Puts("msgctxt \""); potFile.Puts(pair.context); potFile.Puts("\"\n");
                      }
+                     potFile.Puts("msgid \""); potFile.Puts(pair.string); potFile.Puts("\"\n");
                      potFile.Puts("msgstr \""); potFile.Puts(pair.string); potFile.Puts("\"\n");
                      potFile.Puts("\n");
                   }