codestyling
Forum Replies Created
-
Your are kidding me, isn’t it ?
_e('Sales in ', 'td') . _e('USA');
Running this code is useless, because what should the concatination of strings do? The function _e() echos the result immediately and returns nothing for concatination. Depending on where this is running, you will see either never the USA terms, because the code runs at a filter prior to the started output (and you can’t set the HTTP header afterwards) or if it runs inside a templates code, you would get at least:Vendas em USA
All other outputs you may get are depending on interaction of installed plugins like qTranslate, WPML or others, they may translate some terms under the hood. Having no plugins running and using the normal WordPress standard theme for your blog, you will never get USA translated.
And furthermore USA is not a term of WordPress itself. The core doesn’t use it.You didn’t understand it fully. The “standard” textdomain belongs to WordPress itself! If those strings are missing, your target blog has no WordPress language file for the core PHP files loaded.
Even if you would produce the mo file by po edit with all the “default”s occuring contained, the texts won’t be presented as the demo plugin above does show. “default” always lookup for WordPress language file and nothing else. Even if this texts are contained in your “xyz” textdomain, they won’t be taken.Thats why this option is not included nor it makes sences and will not be included in future.
To complete the subject, my plugin is able to support mixed textdomains, you can use it by loading both textdomains.
As you may also notice, you will get the generate mo-file button for the “second_texdomain” too. By pressing it, my plugin generates a second file only containing those translations.Extend the plugin’s code to:
<?php /* Plugin Name: Test the Textdomains */ load_plugin_textdomain('first_textdomain', PLUGINDIR, ''); load_plugin_textdomain('second_textdomain', PLUGINDIR, ''); add_filter('the_content', 'append_paragraph'); function append_paragraph($content) { return $content.'<p>'.__('Hello', 'first_textdomain').' '.__('World.','second_textdomain').'</p>'; }you will get the translation as:
<p>Say Yes.</p>Because my plugin is able to generate two files:
first_textdomain-de_DE.mo second_textdomain-de_DE.moand assumed you load both textdomains, than you get the expected results. This is an advance feature and can be used to split backend only strings from frontend only strings.
This speeds up the page load on frontend, because normally the ammount of backend strings is in most cases dramatically higher than frontend strings (big plugins have approx. 700 strings but only approx. 30 used at frontend).
Using this feature allows to load one of the textdomains only at backend and avoids at the above example string count the pollution of memory with 670 strings never used for frontend rendering.There ist no way to do that, because it simply makes no sence. Having a mixture of different textdomains inside a plugin or theme doesn’t work as you may expect. Thatswhy my plugin issues warnings and errors and separates the textdomains.
Let’s do a simple example. Starting with the simple plugin’s code:
<?php /* Plugin Name: Test the Textdomains */ load_plugin_textdomain('first_textdomain', PLUGINDIR, ''); add_filter('the_content', 'append_paragraph'); function append_paragraph($content) { return $content.'<p>'.__('Hello', 'first_textdomain').' '.__('World.','second_textdomain').'</p>'; }… and following the normally *.po file content:
#: test-the-textdomains.php:10 msgid "Hello" msgstr "Say" #: test-the-textdomains.php:10 msgid "World." msgstr "Yes."…and lets assume, the *.mo file contains both.
What would you expect as appended paragraph at each post content?
This is the original (no translation loaded):<p>Hello World.</p>This is what you would expect:
<p>Say Yes.</p>'and this is what you will get really:
<p>Say World.</p>Because you load a language file in scope of “first_textdomain” and try to call for the translation of “second_textdomain“, there is no loaded translation for and the original remains as is even if it would be inside the *.mo file loaded in scope of “first_textdomain“.
Thats the reason for the issued errors and excluding of mismatching textdomain strings, they can’t be found even they would be inside the *.mo and only blow up the size of the file with no further value.
i need an example and the full error message (containing line numbers etc.)
Please send me a mail with the data required for this language to be added.
Has been implemented with version 1.99.17 and works now along with the additional Microsoft API as you want it.
Forum: Plugins
In reply to: [Codestyling Localization] [Plugin: Codestyling Localization] Plugin brokenAt least one theme, namely NomNom theme as example, pollutes the plugin pages with it’s color jquery scripts. Because of such badly desinged themes my plugins become broken, even if it’s not.
In any case of this, the source is a plugin or theme with bad code.Texts within the “standard” Textdomain are stored into the *.po file but doesn’t need to be translated nor they will become part of the generated *.mo file. The plugin only uses the targets textdomain and the directly related strings to create the translation file.
It generated translation files releated to standard locale specifier like “de_DE”. Unfortunately qTranslate inlo uses the short form “de” and doesn’t load any translation files thatswhy.
Renaming the files via FTP solves the qTranslate load issue but afterwards this plugins doesn’t find them any more.
This is subject of future releases, sorry.Seems that your server uses a different user for FTP and PHP execution. This may affect files uploaded by FTP and modified by PHP. Downloaded plugins and themes within WordPress by PHP should be translatable.
This problem will be solved in future versions.Please send me the translation by mail, can be found at my imprint page. Would be a good idea to incorporate changes from 1.99.17 first.
Has been solve with version 1.99.17 and enables now Google Translate V2 API and Microsoft Translate Service.
This is subject of future development in relation to a well working translation backup system.
I’m currently working on a draft spec how to solve this backup issue. It’s not that easy to handle all for none programming related user.