Skip to content

Instantly share code, notes, and snippets.

@rodica-andronache
Last active August 29, 2015 13:59
Show Gist options
  • Select an option

  • Save rodica-andronache/10651746 to your computer and use it in GitHub Desktop.

Select an option

Save rodica-andronache/10651746 to your computer and use it in GitHub Desktop.
Poedit
Traducere plugin:
In fisierul principal:
function a_testimonial_basics_plugin_setup () {
load_plugin_textdomain('TweetOldPost', false, 'tweet-old-post/languages');
}
add_action( 'plugins_loaded','a_testimonial_basics_plugin_setup');
Si fisiere .mo si .po din languages se numesc:
TweetOldPost-de_DE.mo respectiv TweetOldPost-de_DE.po
!!!!!!!!!!!!!!!!!!!!
Daca folosesc o versiune mai veche de Poedit, gen 1.4.5, pot crea automat tot
https://pippinsplugins.com/localizing-and-translating-wordpress-plugins/?
New Catalog
La base path pun ../ ( Pentru ca fisierul se afla in /languages)
La Paths: pun . (directorul curent) si alte directoare care mai sunt acolo gen includes
http://www.wpexplorer.com/localize-translate-your-wordpress-themes/
http://codex.wordpress.org/WordPress_in_Your_Language
Creez un fisier .pot cu denumirea ca si tema. In el pun ceva de genul:
msgid ""
msgstr ""
"Project-Id-Version: cwp-robi\n"
"POT-Creation-Date: 2014-06-19 17:09+0200\n"
"PO-Revision-Date: 2014-06-19 17:10+0200\n"
"Last-Translator: \n"
"Language-Team: codeinwp <codeinwp>\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.5\n"
"X-Poedit-Basepath: C:\\Users\\Rodica\\Documents\\GitHub"
"\\cwp-robi\\\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-SearchPath-0: .\n"
In poedit, deschid fisierul asta, si imi creeaza automat .po si .mo. In .po pot adauga traduceri daca vreau.
Ca sa aiba efect traducerea intr-o tema de wordpress, trebuie ca in folderul temei sa am un folder languages in care sa pun cele doua fisiere .mo si .po, si in wp-config.php sa modific define('WPLANG', 'nume_tema');
-----------------------------------------------------------------------------------------
POEDIT – How to create the .po translation files:
1. Download and install poedit (http://www.poedit.net/download.php)
2. Open POEDIT: On the top menu click: file > new catalog (terms may vary, depending on the language of your POEDIT)
3. On the new opened dialog box, enter the name of your project, the team’s (your) name, your e-mail, the language, and the encoding. DO NOT enter anything else, especially the country, or your plugin will by country dependent instead of language dependent.
4. Still on the same dialog box, click the tab “Paths” (the 2nd tab), and enter the path where your php files are, so the library know where to scan for translations. Then in the icon buttons click “new entry” (wait for the tooltip to know for sure), enter dot “.” (without the parenthesis “” of course), and click in the empty space in the dialog box, so the system assume it.
5. Still on the same dialog box. click the tab “Keywords) (the 3rd tab), and in the icon buttons click “new entry” (wait for the tooltip to know for sure). Then enter two underscores “__” and click in the empty space in the dialog box, so the system assume it. Do the same again but this time enter “_e”
6. Click OK and you’re done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment