[wp-polyglots] .mo to .po
    Per Søderlind 
    per at soderlind.no
       
    Mon Jul 24 17:37:44 GMT 2006
    
    
  
You can do it with php using the code below.
../Per
 
<?php
include 'wp-config.php';
$mofile = dirname(__FILE__) . '/nb_NO.mo';
 
if ( is_readable($mofile)) {
     $input = new CachedFileReader($mofile);
     $mo2po = new gettext_reader($input);
     $mo2po->load_tables();
     echo "<xmp>"; // I know that xmp is officially deprecated , but it
works ;)
     foreach ($mo2po->cache_translations as $msgid => $msgstr) {
          echo "\n";
          if ($msgid == "") {
                echo 'msgid ""' . "\n";
                echo 'msgstr ""' . "\n";                  
                foreach (split("\n",$msgstr) as $val) {
                     if ($val != "")
                          echo '"' . $val . '\n"' . "\n";
                }
          } else {
                echo 'msgid "' . $msgid . '"' . "\n";
                echo 'msgstr "' . $msgstr . '"' . "\n";
          }
     }    
     echo "</xmp>";
} else {
     echo 'ERROR: file not readable: ' . $mofile; 
}
?>
 
From: wp-polyglots-bounces at lists.automattic.com
[mailto:wp-polyglots-bounces at lists.automattic.com] On Behalf Of René Clausen
Nielsen
Sent: 24. juli 2006 18:13
To: wp-polyglots at lists.automattic.com
Subject: RE: [wp-polyglots] .mo to .po
 
Brilliant. That worked like a charm.
 
Being a complete moron when it comes to something than cannot be clicked, I
had to give it a few tries, though. So, for future reference:
 
In the command promt, it should look a bit like this: C:\Program
Files\poEdit\bin> msgunfmt [path_to _file.mo] > [path_to_file.po].
 
Cheers matie,
 
René
 
From: wp-polyglots-bounces at lists.automattic.com
[mailto:wp-polyglots-bounces at lists.automattic.com] On Behalf Of Seok-moon
Jang
Sent: 24. juli 2006 17:36
To: wp-polyglots at lists.automattic.com
Subject: Re: [wp-polyglots] .mo to .po
 
There is msgunfmt in poedit installer for windows
Default Installation directory is C:\Program Files\poedit.
You can find this program at C:\Program Files\poedit\bin.
 
In command windows(cmd.exe for WIN XP), run next command.
 
C:\>msgunfmt YourLanguage.mo > YourLanguage.po
 
If you want to recompile to .mo, you can use msgfmt at same directory with
msgunfmt.
 
 
PS. sorry for using poor english.
 
----- Original Message ----- 
From:  <mailto:rcn at shevy.dk> René Clausen Nielsen 
To:  <mailto:wp-polyglots at lists.automattic.com>
wp-polyglots at lists.automattic.com 
Sent: Monday, July 24, 2006 10:33 PM
Subject: [wp-polyglots] .mo to .po
 
Hi List,
 
Anybody know if it possible to convert a .mo to .po? I seem to have
forgotten where I put the .po file in the first instance and now that I want
to update the language file, I can only seem to find the .mo in use. Bugger.
 
I am working on a Windoze PC.
 
Regards,
 
René
  _____  
_______________________________________________
wp-polyglots mailing list
 <mailto:wp-polyglots at lists.automattic.com>
wp-polyglots at lists.automattic.com
 <http://lists.automattic.com/mailman/listinfo/wp-polyglots>
http://lists.automattic.com/mailman/listinfo/wp-polyglots
 
  _____  
I am using the free version of SPAMfighter for private users.
It has removed 2706 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter <http://www.spamfighter.com/go.asp?t=249>  for free now!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/wp-polyglots/attachments/20060724/cd615c4a/attachment.htm
    
    
More information about the wp-polyglots
mailing list