Custom BBCodes localization

Having a question about translating phpBB3? Want to discuss and collaborate with people currently translating phpBB3? Here would be the correct place to do so.
Suggested Hosts
Locked
User avatar
-=ET=-
Registered User
Posts: 799
Joined: Sun May 25, 2003 5:32 pm

Custom BBCodes localization

Post by -=ET=- »

Hi,

I've installed some few custom BBCodes, but like for default BBCodes (as Font colour) is it possible to...
  1. choose a different button label than the BBCode tag?
  2. localize the button label?
  3. localize the button help line?
Thanks! :)
Last edited by -=ET=- on Mon Aug 17, 2009 9:37 pm, edited 1 time in total.
Eternal newbie
User avatar
-=ET=-
Registered User
Posts: 799
Joined: Sun May 25, 2003 5:32 pm

Re: Custom BBCodes localization

Post by -=ET=- »

Ok after some few searches in the code, I'm now sure it's not possible.

So I'll suggest this improvement to the phpBB dev team, but if some of you have the same concern, here is how I've solved the issue.

In includes/functions_display.php, find...

Code: Select all

            'BBCODE_TAG'        => $row['bbcode_tag'],
            'BBCODE_HELPLINE'    => $row['bbcode_helpline'], 
And replace with...

Code: Select all

            'BBCODE_TAG'        => ($user->lang['BBCODE_'.strtoupper($row['bbcode_tag'])]) ? $user->lang['BBCODE_'.strtoupper($row['bbcode_tag'])] : $row['bbcode_tag'],
            'BBCODE_HELPLINE'    => ($user->lang['BBCODE_'.strtoupper($row['bbcode_tag']).'_HELP']) ? $user->lang['BBCODE_'.strtoupper($row['bbcode_tag']).'_HELP'] : $row['bbcode_helpline'], 
That's all! :)

By default nothing will change, as if no specific language string exists, it will continue to take what is set in the ACP. But it now allows you to add 2 new language strings by BBCode in the posting.php language file of each language...
  • BBCODE_<BBCODE_TAG> where <BBCODE_TAG> is the tag in upper case set in the ACP
  • BBCODE_<BBCODE_TAG>_HELP where <BBCODE_TAG> is the tag in upper case set in the ACP
Example: if you have installed the YouTube custom BBCode, you must have set "[youtube]{IDENTIFIER}[/youtube]" in BBCode usage. So your tag is "youtube" (all in lower case).

Then for English, you can add the 2 new strings in language/en/posting.php...
  • BBCODE_YOUTUBE => 'YouTube',
  • BBCODE_YOUTUBE_HELP => 'YouTube video: do this, do that...',
For French the 2 new strings in language/fr/posting.php...
  • BBCODE_YOUTUBE => 'YouTube',
  • BBCODE_YOUTUBE_HELP => 'Vidéo YouTube: faites ceci, faites celà...'
And so on for other languages...

I hope it will be useful for some of you :)
Eternal newbie
Locked

Return to “[3.0.x] Translations”