PHP & ?? How to edit a "Message catalog binary file?" or "GNU Gettext..."
Firefox Wins Offline
Member
***
Posts: 164
Joined: Mar 2008
Post: #1
PHP & ?? How to edit a "Message catalog binary file?" or "GNU Gettext..."
Need to change a string in a language file?
Should be easy, right?  Tongue
The filesize is ~24KB, but all that shows up is somewhat like this:

Code:
Þ•6


The file extension is = .mo
Searching...

mo - MM2 Output chemical modeller output file

mo - Dymola simulation file

mo - GNU Gettext machine object file   ?

mo - Pidgin instant messenger language file

mo - Audacity language file

mo - Message catalog binary file  >>> How to edit this file?

...or would a php script use a "GNU Gettext machine object file?"



EDIT:
Making some progress:
.mo files are created from .po files   (Duh!  Wink)
Currently checking if this can read binaries, or only goes one-way:
Poedit is cross-platform gettext catalogs (.po files) editor...


EDIT#2:
This result...

(12-04-2010 04:42 PM)Firefox Wins Wrote:  The filesize is ~24KB, but all that shows up is somewhat like this:

Code:
Þ•6

... was when using WinSCP to view a remote file:

It might be time to take a second look at Notepad++
  • Can regular Notepad re-save a binary file?

Thank you...


EDIT#3
In regular Notepad I can read most of the file, but still need to test if it will save properly as a binary.
In Notepad++ (w/ default settings) = Messed up garbage...

Oh well, too much fun  Yipi
Will check back later.
(This post was last modified: 12-04-2010 05:26 PM by Firefox Wins.)
12-04-2010 04:42 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: PHP & ?? How to edit a "Message catalog binary file?" or "GNU Gettext..."
What the hell are you doing?

Notepad and co aren't designed to edit binary files, they're designed for text.  Hex editors are better suited for binary files.
But I have no idea what file you're trying to edit and where you got it from.  It may be visible as plaintext, or even as encoded (ie UCS-2) plaintext, but there's no guarantee.  For example, a simple layer of compression will stuff up your attempts.
But you can try a search with a hex editor if you wish though.

My Blog
12-04-2010 06:21 PM
Find all posts by this user Quote this message in a reply
Firefox Wins Offline
Member
***
Posts: 164
Joined: Mar 2008
Post: #3
RE: PHP & ?? How to edit a "Message catalog binary file?" or "GNU Gettext..."
(12-04-2010 06:21 PM)ZiNgA BuRgA Wrote:  What the hell are you doing?

Notepad and co aren't designed to edit binary files...

Well, I suppose Yahoo! Answers isn't designed to give very good answers.  Tongue
The attempt to use Notepad++ started there @ a Yahoo question/answer.
The Best Answer - Chosen by Voters, would work for most of the file-types mentioned, but not .mo


(12-04-2010 06:21 PM)ZiNgA BuRgA Wrote:  But I have no idea what file you're trying to edit and...

Sure you do:
Quote:"...Making some progress:
.mo files are created from .po files"
^^^
The quote ".mo files are created from .po files" is based on what I saw at Wordpress.org.
FYI: There isn't much (easy) to find about .mo files with a quick Google search. They are used in Language files for some scripts.

(12-04-2010 06:21 PM)ZiNgA BuRgA Wrote:  ...and where you got it from...
Comes from an open source PHP script downloaded from sourceforge.net; Wordpress also seems to use similar files.

From Worpress
"MO (Machine Object) files
    The final step in the localization process is that the PO file is run through a program that turns it into an optimized machine-readable binary file (MO file). Compiling the translations to machine code makes the localized program much faster in retrieving the translations while it is running."

I'll look at a hex editor, thanks for the tip.
Update:
No luck yet with a final answer.
With WP (for example), they offer downloads of the source (.po) files, which can be converted, using Poedit, into .mo files.
Poedit does not open .mo files, only a one-way (export)


Do you (or anyone else) have a favorite hex editor, which works with different file extensions?
(This post was last modified: 12-04-2010 10:06 PM by Firefox Wins.)
12-04-2010 09:09 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: PHP & ?? How to edit a "Message catalog binary file?" or "GNU Gettext..."
Oh okay, it's a Wordpress file.  That makes it much clearer.  As you mentioned "binary", I thought you were trying to edit a game related file or similar.
".mo" and ".po" make absolutely no sense to someone who doesn't use Wordpress (and possibly confuse people who do).

(12-04-2010 09:09 PM)Firefox Wins Wrote:  Do you (or anyone else) have a favorite hex editor, which works with different file extensions?
Makes no sense, cause hex editors edit any file.
I personally like the free HxD, though HexWorkshop and maybe UltraEdit are popular commercial editors.
However, unless you know what you're doing, a hex editor probably won't help.
Especially with editing binary files.

Taking a look at a sample Wordpress .mo file, there seems to be a bunch of 32-bit ints at the top of the file.  There's a good possibility that this is an index, so editing stuff below willy nilly will probably break the file. (if I were to take a 1 minute guess without checking, they're 2x 32-bit pairs, yielding an offset and length descriptor).

My Blog
(This post was last modified: 12-04-2010 10:47 PM by ZiNgA BuRgA.)
12-04-2010 10:45 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: