How to get the .po file from .pot files - cakephp

I use cakePHP 2.0 and use the console tool to create one .../app/locale/default.pot . Now, I would like to get my site translated into multiple languages. I read the paragraph about internationalization in the cakephp cook book (http://book.cakephp.org/1.2/en/view/162/Internationalizing-Your-Application).
I copy the default.pot files into
.../app/locale/eng/LC_MESSAGES/default.pot
.../app/locale/fre/LC_MESSAGES/default.pot
.../app/locale/pol/LC_MESSAGES/default.pot
...
And enter the tranalations string with an utf-8 text editor (as gedit). And ... my site do not get translated at all.
I have noticed the AppController may implement some code to change the Configure::write('Config.language', some_three_letters_language), as the configuration changed nothing, I have implemented some very simple code.
// in AppController
public function beforeFilter() {
Configure::write('Config.language', 'fre');
}
Why does the translation function always return it arguments and not the translated string in .pot files ( in views, __('Something') -answers-> 'Something')?
I found nowhere were .pot files are translated into .po. How can I get those .po files, with REHL or CentOS (cannot get any suitable packet with po or poeditor in the name)?
Thanks for your answer.

.pot and .po files are the same file format. .pot stands for "PO template". The difference being that you're supposed to use this template file and give it to your translators, who will produce the translated .po files. The .pot file is the template for several localized .po files. See http://www.gnu.org/software/gettext/manual/gettext.html#Files.
In other words, just renaming .pot to .po will do.
In the proper gettext workflow, there's the msginit tool for doing this, which will also set a number of headers to the correct values for the chosen locale.

Related

Empty PO file when scanning ctp files

I'm trying to localize my php app that uses .ctp files for the views.
Here a sample of a file's content:
<h2><?php __('Menu');?></h2>
<table >
<tr >
<td style="text-align:left>
<?php echo $html->link('Main Config','/admin/configs/index')?>
</td>
</tr>
PS: this is not my code and I cannot change it - but I need to translate it!
I tried following threads using POEdit and tried this solution, which however seems to be on a previous version of POEdit...
So I created a new po file for de-DE in my root directory (standard encoddings, ...), opened the catalog's preferences and added . and one specific /subdir/test.ctp file containing above code) to my source paths, then added _ and __ to the additional keywords (as well as some others I found to contain some text such as input and link, for example).
Then, whether I use update, update from source, no string is found - it says "Translated 0 from 0 (0%)"...
What am I doing wrong here?
NOTE: this is on a windows 10 pc with only POEdit installed, I didn't install php nor php-gettext installed directly on my machine, but they're supposed to be embedded in POEdit from what I could read...
.ctp extension is not recognized by GNU gettext's xgettext as a PHP extension — such files are skipped over. I just added special treatment for it to Poedit a week ago, so it will be fine in Poedit ≥ 2.0.8.
Until then, you can add a custom extractor (using the same syntax as in Poedit 1, see the placeholder examples in the window where you enter it) for *.ctp files.

Huffman compressed files with my own extension

I am working on a project that uses Huffman algorithm to compress files, and I am doing my project using Java, what I want is to create my own file extension say (.huff) for the compressed file, and when I right click a file if it has the (.huff) extension, I want to add a new option which decompresses it, I searched the web but I did not find anything useful.
Any help would be appreciated.
To set the file extension just use one of the String methods like append(".yourExtension") (append it to the filename) and set as filename. Simple as that.
String filename = filename.append(extension);
To decompress the compressed file, I suggest you write a metod to which you provide a path to file as argument, check if the file extension is correct and then in another method you decompress this file.
There is nothing special about a file extension, it's just a part of the file name. To create a .huff file extension, just add .huff to the end of the file name.
To add the windows context menu, that's explained in the question linked in the comments How can I add a context menu to the Windows Explorer for a Java application?
I would recommend creating a batch script that will launch your program taking in the file to decompress as an argument.
Something similar to:
#echo off
java -cp <path-to-jar> <decompression main class> %1
Adding in any other setup or program arguments you need. Then a registry entry might look like.
HKEY_CLASSES_ROOT\.huff\shell\Decompress huffman encoded file\command
"<path to batch file>" "%1"

Cakephp 3 i18n not working

I have cake 3 fresh installation.
I have a simple po file in this location src/Locale/de_DE/default.po with the following content.
msgid "test"
msgstr "test in german"
On my home page template file I have simple <?php echo __('test'); ?>
I need to set the locale on the fly, so I add this to my AppController's beforeFilter(or initialize) - I18n::locale('de_DE'); however test is not being translated. I can't figure out, what Im missing. I tried renaming all to iso2 - de, but it did not translate either.
Thanks
Open your Terminal, cd to your project folder (the one which contains the bin folder) and type:
bin/cake cache clear_all
That's all. Refresh your page right after.
One last thing, be sure to place your .po files in:
Locale/de_DE/your_translations.po
I like to use POEdit to manage my translations. Cheers.
Maybe this helps:
If you are working on a local maschine and use bin/cake i18nto generate the translation files, make sure the files are readable by your local webspace.
This drove me cracy.

Cakephp 3 : Unable to apply Localization in a simple text.

I am following this doc to learn localization basic. I have followed below step
I have an index.ctp file here I have added a headline
<h2><?= __('Popular Articles') ?></h2>
Now for .pot file I have used below command
bin/cake i18n extract
default.pot file generate well then I have moved this file to
src\Locale\jp\default.pot
Here I have found below line in default.pot
#: Template/Tests/index.ctp:1
msgid "Popular Articles"
msgstr ""
I have added msgstr "人気の記事"
Now in config/bootstrap.php I have added below code to make default language jp
ini_set('intl.default_locale', 'jp');
Still it's giving me same output.
change the file name as default.po
change the folder name as ja_JP
and also ini_set('intl.default_locale', 'ja_JP');
Translation folders can either be the two letter ISO code of the language or the full locale name such as fr_FR, es_AR, da_DK which contains both the language.
more info: http://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html#language-files

Gamemaker export code for Gource

Is there a way to use Gamemaker with Gource?
Or is there something like a tool or library to export / convert .gmk files to .txt files each of them with one class?
While pre-Studio projects are stored as single files, you can use Gmk-Splitter to split the .gmk file into a number of XML files (not too unlike the format used by GameMaker: Studio) or recompose the file from a set.
While not ideal, this permits to use source control with older versions of GameMaker. See the author's "Gang-Garrison-2" repository for an example of that in action.
With .gmk it's impossible. But if you will use GMS then you can try do it, because GMS uses .xml (i.e. text) files. I checked it with git and mercurial and it works fine.

Resources