Please, what is the best way to make language pack for a payment plugin

  • Richard
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • I am a freelance web developer
More
3 years 1 month ago #147568 by Richard
Hi Everyone,

I am currently developing a payment plugin for a client and I am confused on the best approach to make the plugin translatable. I am finding this a bit confusing since MP payment plugins are not your regular Joomla plugin (that one is easy to implement).

I develop this plugin using English, but my client audience are primarily not English speaking, so the need to make this plugin have multilingual support.

So, I need help on how to get this plugin translatable to any language out there with ease.

Regards,
Rich
---

Please Log in or Create an account to join the conversation.

More
3 years 1 month ago #147599 by Tuan Pham Ngoc
As of right now, unfortunately, we do not support translating payment plugins. Exactly what you want to translate from the payment plugin?

Please Log in or Create an account to join the conversation.

  • Richard
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • I am a freelance web developer
More
3 years 1 month ago - 3 years 1 month ago #147602 by Richard
Hi Tuan,

Thanks for your response.

Anyway, since your response didn't come on time, I had to dig around to find a way around the issue.

So, here is my solution in case anyone is interested in it for any reason.

1) Created a language folder and files under my payment plugin folder thus:
Code:
os_paymentpluginname (folder) -os_paymentpluginname.php (file) -os_paymentpluginname.xml (file) -paymentpluginname (folder) --language (folder) ---en-GB (folder) ----en-GB.paymentpluginname.ini (english language file) ---fr-FR (folder) ----fr-FR.paymentpluginname.ini (french language file) ...

2) Include the language containing folder, paymentpluginname, in my plugin XML file thus:
Code:
... <files>     <filename>os_paymentpluginname.php</filename>     <folder>paymentpluginname</folder> </files> ...


3) Load language file manually from my plugin construct
Code:
public function __construct($params, $config = array())  {     // Load plugin language file     $lang = JFactory::getLanguage();     $lang_path = JPATH_SITE . '/components/com_osmembership/plugins/paymentpluginname';     $lang->load('paymentpluginname', $lang_path);          parent::__construct($params, $config); ...
    
4) Then I can use the language constant to get required text.
Code:
$text = JText::_("PLUGIN_LANGUAGE_CONSTANT_TEXT");

----

I needed this because my client is running a multilingual site and the payment plugin loads on the site (not redirected). So, I needed a way to translate plugin payment instructions to the active language.
Last edit: 3 years 1 month ago by Richard. Reason: Added XML file modification
The following user(s) said Thank You: x-bit

Please Log in or Create an account to join the conversation.

More
3 years 1 month ago #147605 by Tuan Pham Ngoc
Hello Richard

Yes, your code looks good. So far, most payment plugins are developed by us and for simplification, if something need to be translated, I added it directly to language file of the extension (so that it can be translated via Translation interface)

That's the reason we do not support language files for payment plugin anymore (it was supported in the part)

For now, please use your code, it works OK and solve your issue

Regards,

Tuan

Please Log in or Create an account to join the conversation.