Wordpress translation PO file - wordpress

I've got an issue with a Wordpress that I'm taking over now.
There is a .mo file containing some translations and a .po file that seems to be the source. The .po file seems have been generated somehow but its structure look a little weird to me.
Here is what can be found inside.
#: /Users/yui/Sites/fondation/wp-content/themes/fondation/taxonomy-programme.php:24
msgid "Exhibitions"
msgstr "Expositions"
#: /Users/yui/Sites/fondation/wp-content/themes/fondation/archive.php:69
#: /Users/yui/Sites/fondation/wp-content/themes/fondation/single.php:43
msgid "[:en]Events[:fr]Evénements[:de]Events[:pl]Events"
msgstr ""
When I try to generate the .mo file msgcat fondation-fr_FR.po | msgfmt -o fondation-fr_FR.mo - the .mo file contains only the first one (with both msgid and msgstr) but not the other one. The website also have an issue with that and display only the translation found in the .mo file.
Any thoughts on how to fix the .po file? Is it an old format?

but its structure look a little weird to me.
Indeed. Looks like being done by somebody who had no idea how gettext works or that manuals are a thing and creatively abused gettext files (case in point: see the multiple translations in the msgid of all places).
The second string is not included in the compiled translations table (i.e. MO) because it has no translation — msgstr is empty.
BTW, everything about how gettext works, including how strings are retrieved and why it makes no sense to include untranslated entries in MO (hint: the string is already in the code!), is very well explained in the GNU gettext manual.
BTW2, that invocation of msgcat is also an entirely pointless busy work — see its man page for what it does (same as cat plus some smarts).

For the records.
The .po file had been generated by an old version of qtranslate plugin for Wordpress which didn't know how to properly handle the gettext functions in its firsts versions.
Nothing could be done to get the .po file to work. I had to create a new one manually.

Related

QT Linguist ts file names in pro file

How does QT Linguist know the ts file defined in the project file is for a specific language? (Is the "_ja" characters in the name how it determines the language? I couldn't find anything in the documentation.)
I have a ts file defined as "testdata_ja.ts" in the project file. Running lupdate, the file is generated. In the ts file there is a line:
<TS version="2.1" language="ja_JP">
lupdate seemed to figure it out, but nothing was translated, all entries are "unfinished". I put an entry in the code that was in the Japanese phrase book.
The phrasebook is just a hint/help for the human translator, lupdate will never automatically translate anything for you. Any translations in the .ts file still need to be populated and/or marked as completed "manually" (typically in QtLinguist, but one could use any text editor, or a script, or whatever).

How to access "hidden" file(s) inside .jpg file?

I have this .jpg file that cannot be opened nor viewed. But the thing is my friend who sent me this file said that this file actually contains hidden files inside and is MOST likely encrypted. I searched on Google and I found out that I had to rename the extension ".jpg" to ".zip" and tried to extract the file but it doesn't work. I forgot the message that was shown during my attempt to extract. Maybe the file is actually not a .jpg but something else and is corrupt or maybe it has "hidden" files inside.
So I'm wondering if you guys could help me out.
You should use TrIDNet http://mark0.net/soft-tridnet-e.html. I didn't test it but I think that you seek for something like this. Your file has an unknown type and you must find with which known type it matches.

silverstripe does not pick up changes in language yml files

silverstripe does not seem to pick up changes in the language yml files. This used to work. As usual I am doing ?flush=all after the files are changed...
In the templates I am using the t- function like <%t General.GoToPortfolio "zum Portfolio" %>
I was editing existing entries, but the template always shows the old 'version' of the entry. If I remove the en.yml file then the translations are really gone. So I am assuming it works at least a little bit...
At the moment I am using silverstripe 3.1.12
The files are saved here e.g.: module/lang/en.yml
Thanks,
Florian
I had this problems some time ago with german umlauts and wrong encoding of the files. So either tell your editor or IDE to encode and write proper utf-8 (best without bom) or htmlencode your umlauts.
finally found it:
deleted the contents of silverstripe-cache folder and it worked.

Convert meta tags in txt file to .po / .mo file

I hope somebody can save a noob: We have a simple multi language site and want to move it to wordpress. Problem: We had it translated like this: Example Translation and it looks like the theme I want in wordpress handles multilanguage in .po and .mo files.
All the texts remain the same and we clearly can't translate the whole site again. Is there an easy way to convert the text files? What would the most hassle-free method be?
Any help, tips, or recommendation is hugely appreciated.
the .po files have a complete different structure then the file shown
###############
# meta
###############
define("L_TITLE_HOME", "HOME");
define("L_TITLE_REFERENCE", "Referenzen");
define("L_TITLE_SOFTWARE", "Unsere Software");
define("L_TITLE_COMPANY", "Über uns");
define("L_TITLE_PARTNER", "Für Partner");
define("L_TITLE_INVESTOR", "Für Investoren");
the gettext system doesn't recognize this type of files, so the best way i see you gonna have to copy the original .po file on your theme, rename it and then make the input off the translated vars manually.
But the best way in the the other languages its to have them translated directly on the respective .po files to avoid conflicts like this.

Getting extension of the file in FileUpload Control

At the moment i get file extension of the file like :
string fileExt = System.IO.Path.GetExtension(filUpload.FileName);
But if the user change the file extension of the file ( for example user could rename "test.txt" to "test.jpg" ), I can't get the real extension . What's the solution ?
You seem to be asking if you can identify file-type from its content.
Most solutions will indeed attempt the file extension, but there are too many different possible file types to be reliably identifiable.
Most approaches use the first several bytes of the file to determine what they are.
Here is one list, here another.
If you are only worried about text vs binary, see this SO question and answers.
See this SO answer for checking if a file is a JPG - this approach can be extended to use other file headers as in the first two links in this answer.
Whatever the user renames the file extension to, that is the real file extension.
You should never depend on the file extension to tell you what's in the file, since it can be renamed.
See "how can we check file types before uploading them in asp.net?"
There's no way to get the 'real' file extension - the file extension that you get from the filename is the real one. If file content is your concern, you can retrieve the content type using the .ContentType property and verify that it is a content type that you are expecting - eg. image/jpg.

Resources