Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OLD: Fix all language strings in shipping/payment plugins - parameters #19

Closed
cpaschen opened this issue Sep 29, 2012 · 5 comments
Closed

Comments

@cpaschen
Copy link
Member

The shipping and payment plugin parameters language strings aren't getting translated.

Looks like the language file isn't getting included or activated.

@cpaschen
Copy link
Member Author

History

#4 Updated by Mikael Colboc 4 months ago

Maybe this will help, this is what I understood so far:

the forms in questions are:

admin/views/shipping/tmpl/form.php
admin/views/payment/tmpl/form.php

on line 49 they both call : $this->params->render('params')

which comes from: $params = new JParameter( ...

admin/views/shipping/view.html.php on line 81
admin/views/payment/tmpl/form.php on line 46

But this only loads the parameters within in the xml files, not the language file.

So the output is only the raw plugins parameters form.

I don't know if it's only the language that is not loaded or if the language strings are not processed. (or both?)

Tooltips for the parameter labels are not working either...this $output does not seem complete.

#3 Updated by Chris DioscouriChris Paschen. 5 months ago
Assignee changed from Chris DioscouriChris Paschen. to Lukas Polak
Priority changed from Normal to Urgent

OK .. it makes no sense to spend the time to change all the language strings in the main tienda language file, when all the plugin language files are already converted, and they are correctly completed.

Lukas - if you can let me know what we need to do to get these plugins to pull their admin-side params details from their own language plugins, I can then do that for each of them.

I've already tried manually calling the language file from the plugin php file (using JFactory::getLangauge and 'load'), but it still doesn't load the language file.
I've also messed around with the XML file quite a bit and no different structures seem to work there either.

It appears that because Tienda is displaying the plugin admin screen itself (and not being displayed directly from Joomla directly) the plugin's language file isn't being called.

The language translations are working correctly when you open the plugin within the Joomla plugin manager.

If you can just give me an example with one of these I can take care of the rest.

#2 Updated by Chris DioscouriChris Paschen. 5 months ago

For some reason, the admin-side config for these plugins is NOT pulling the strings from the included language.ini files. They are pulling from the main tienda admin language file. [for translation of the admin params entries]

Not sure why but it means that in order to translate a shipping plugins, you must have the language strings in the main language file. So the shipping plugins really aren't 'plugins' - they have to be shipped with the core (or update the core language file.

I'm going to create a separate ticket to fix that issue. We can deal with that in the round where we review/fix all the plugins.

For now, I'm just going to update the main language file.

#1 Updated by Chris DioscouriChris Paschen. 5 months ago
Subject changed from Fix all language strings in shipping plugins - parameters to Fix all language strings in shipping/payment plugins - parameters

@efillman
Copy link
Member

There was a small bug with the JForm entries were not using JText but this still did not fix the problem.
echo JText::_($field -> label) ...

I think we also have an issue with if the language files are being loaded properly or not. I think for the admin plugins we are going to have to ramjam load the language files for each plugin somewhere in the model.

Check out
http://docs.joomla.org/JLanguage::load/11.1
http://docs.joomla.org/JLanguage::getLanguagePath/11.1
http://docs.joomla.org/Loading_extra_language_files

In addition check out the source of JLanguage. It is very screwy with how it auto-magically picks which file to load.

It seems to me that at least in 2.5+ it is looking for a language folder not languageS as we currently have. We might have to change this for all the plugins.

I was able to use
$lang =& JFactory::getLanguage();
$lang->loadLanguage(JPATH_PLUGINS.'/tienda/payment_2checkout/languages/en-GB.plg_tienda_payment_2checkout.ini');

obviously this manually loads the language file that is needed.

to get results, in addition there are still some incompatible 2.5 strings floating around the language files

unfortunately loadLanguage is a protected function so I had to core hack the code to make it work. This might be a good candidate to get added to the DSC library to prevent problems like this in the future.

Had a little bit of luck with this
$lang =& JFactory::getLanguage();
$extension = 'plg_tienda_payment_2checkout';
$base_dir = JPATH_PLUGINS.'/tienda/payment_2checkout';
$language_tag = 'en-GB';
$reload = true;
$lang->load($extension, $base_dir, null, $reload);

once again this forces us to change the languages folder to language/en-GB/ for the default

@efillman
Copy link
Member

Im trying to write a shell script to remove all the remaining spaces in the language files

@efillman
Copy link
Member

These admin language files are not copying properly to the joomla root language folder upon install.

@efillman
Copy link
Member

The problem ended up being that when JForm is used you must load the language file uniquely. Currently we pull in the language file when the plugin class is called however this will never happen if JForm is used because the plugin class is never created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants