Skip to Content Skip to Menu

SOLVED: language file for add-on plugin

  • jojo12
  • jojo12
  • OFFLINE
  • Posts: 957
  • Thanks: 109
  • Karma: 25
3 years 11 months ago - 3 years 11 months ago #321555 by jojo12
Hi, I need your help! I didn't find enough help for this
we have an extra plugin for jem-joomlaeventmanager for cb. It works fine.
The english words and translations for frontend are in a old language file english.php and german.php. This works.
(When I compare this with other cblanguage files, there should be a newer style of language file.)

In the Tab Manager in my plugin in the Tab "Params" there is nearby all in english (no translation). How to create a translation file for this?

Thank you for any help.
Last edit: 3 years 11 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48548
  • Thanks: 8290
  • Karma: 1445
3 years 11 months ago #321557 by krileon
Replied by krileon on topic HELP wanted: language file for add-on plugin
Plugin translations are stored in the cbplugin folder of your CB language plugin found below.

/components/com_comprofiler/plugin/language/LANGUAGE_TAG

So for example you'd have the following for CB Activity.

/components/com_comprofiler/plugin/language/de-de/cbplugin/cbactivity-admin_language.php
/components/com_comprofiler/plugin/language/de-de/cbplugin/cbactivity-language.php

Notice that one is for "admin". That contains all backend only translations. To provide the default English translations for a plugin those should be placed in the language folder of your plugin shown below.

/components/com_comprofiler/plugin/user/PLUGIN/language/default_language

Using CB Activity as an example you'd have the below.

/components/com_comprofiler/plugin/user/plug_cbactivity/language/default_language/admin_language.php
/components/com_comprofiler/plugin/user/plug_cbactivity/language/default_language/language.php

You can try putting other defaults there was well, but that's untested however the code for them to load is there. So for example the below might work to provide default German translation for a plugin.

/components/com_comprofiler/plugin/user/PLUGIN/language/de-de/admin_language.php
/components/com_comprofiler/plugin/user/PLUGIN/language/de-de/language.php


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

  • jojo12
  • jojo12
  • OFFLINE
  • Posts: 957
  • Thanks: 109
  • Karma: 25
3 years 11 months ago #321562 by jojo12
Thank you kyle for your quick answer. But these things I just noticed.

But how a new language file should be and how the words in the plugin php?

For frontend I can use CBTxt::T( '...' ) in the plugin php, but then it seems to be hardcoded.

Do I need a key word, which then is used in the language file?

And is this the same for backend?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48548
  • Thanks: 8290
  • Karma: 1445
3 years 11 months ago #321565 by krileon
Replied by krileon on topic HELP wanted: language file for add-on plugin
Are you trying to add translations to a 3rd party plugin? You do that using CBTxt API. You can use it as follows.

Simple
Code:
CBTxt::T( 'This is my language string' )

Key
Code:
CBTxt::T( 'THIS_MY_LANG_STRING', 'This is my language string' )

You don't have to use a language key, but it makes things easier. They are mandatory though if the language string has substitutions like the following.

Code:
CBTxt::T( 'THIS_MY_LANG_STRING', 'This is my language [string]', array( '[string]' => 'string' ) )


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

  • jojo12
  • jojo12
  • OFFLINE
  • Posts: 957
  • Thanks: 109
  • Karma: 25
3 years 11 months ago #321567 by jojo12
Replied by jojo12 on topic SOLVED: language file for add-on plugin
Thank you, Kyle. You made my day!
The following user(s) said Thank You: krileon

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

  • jojo12
  • jojo12
  • OFFLINE
  • Posts: 957
  • Thanks: 109
  • Karma: 25
3 years 11 months ago #321569 by jojo12
Replied by jojo12 on topic SOLVED: language file for add-on plugin
Sorry to disturb you again:

How I do it in Backend in the xml file?
it doesn't work with e.g.
label="CBTxt::T( 'JEMMYEVENTS_START', 'Startdate' )"

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

Moderators: beatnantkrileon
Powered by Kunena Forum