Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Antes on December 20, 2014, 09:18:46 AM

Title: Multilanguage Board Name/Descriptions
Post by: Antes on December 20, 2014, 09:18:46 AM
Once my forum was alive and kicking around, it was in two languages and I always want to make board names/descriptions multilanguage. I'm interested in making cheap tricks or good tricks to make it happen. I'm 100% sure some forums will benefit from it very well. Following changes are basic they cover only boardindex at this point. So what i did;

Boardindex.template open
Code (Find) Select
                        <a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';
Code (Replace) Select
                        <a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', !empty($txt['bname'.$board['id'].'']) ? $txt['bname'.$board['id'].''] : $board['name'], '</a>';

Code (Find) Select
                        <p>', $board['description'] , '</p>';
Code (Replace) Select
                        <p>', !empty($txt['bdesc'.$board['id'].'']) ? $txt['bdesc'.$board['id'].''] : $board['description'] , '</p>';

then simply add $txt['bname<id>'] = 'board_name'; $txt['bdesc<id>'] = 'board_description' to index.english.php

What is your solutions or suggestions?
Title: Re: Multilanguage Board Name/Descriptions
Post by: Arantor on December 20, 2014, 11:03:03 AM
Not doing it is my suggestion.

It creates an inference that is not accurate, namely: if people see a board name in their language, they will assume that board is in that language. Intermixing languages inside a single board invariably confuses people and ends up having a distancing effect.
Title: Re: Multilanguage Board Name/Descriptions
Post by: margarett on December 20, 2014, 06:34:57 PM
There was a MOD for 1.1.x that you might use as a reference ;)
http://custom.simplemachines.org/mods/index.php?mod=1276
Title: Re: Multilanguage Board Name/Descriptions
Post by: Antes on December 20, 2014, 07:07:29 PM
Quote from: Arantor on December 20, 2014, 11:03:03 AM
Not doing it is my suggestion.

It creates an inference that is not accurate, namely: if people see a board name in their language, they will assume that board is in that language. Intermixing languages inside a single board invariably confuses people and ends up having a distancing effect.

In original topic I actually wrote a note for you :P I was 100% sure you gonna say this :D

Quote from: margarett on December 20, 2014, 06:34:57 PM
There was a MOD for 1.1.x that you might use as a reference ;)
http://custom.simplemachines.org/mods/index.php?mod=1276

Nope... 1.1.x too old for me to understand, I barely understand 2.x source part :P

I'm after creating a small tip/trick for people not a big mod fully automated usage etc...
Title: Re: Multilanguage Board Name/Descriptions
Post by: Arantor on December 20, 2014, 07:10:41 PM
Of course I was going to say it, that's what my experience has shown over time.
Title: Re: Multilanguage Board Name/Descriptions
Post by: sangham.net on June 13, 2015, 09:17:49 PM
Thanks for the great share, Antes!

Would it work for Categories as well? How would it need to look like? Thanks in advanced!

As for the outlook here, is it right in regard of id to mention it like that or example (just the number):

$board['id']
and
$txt['bname1'], $txt['bname2'], ... $txt['bname234']

or
$txt['bname<1>'], $txt['bname<2>'], ... $txt['bname<234>']

??
Title: Re: Multilanguage Board Name/Descriptions
Post by: Antes on June 14, 2015, 06:22:29 AM
without <>, you can do it for categories as well same logic applies.
Title: Re: Multilanguage Board Name/Descriptions
Post by: sangham.net on June 14, 2015, 06:40:02 AM
Thanks a lot, Mr. Antes! Most, most helpful. That means such can be made also for things like "News" and other only one "language possible" texts which are input-able in the Admin-panel usually? A kind of out-sourcing of the Admin-panel to the language files, so-to-speak.
Title: Re: Multilanguage Board Name/Descriptions
Post by: Antes on June 14, 2015, 08:07:48 AM
Not sure about news, you probably need to code something for it. Not sure if you can do this trick to news section, you need to try.
Title: Re: Multilanguage Board Name/Descriptions
Post by: sangham.net on June 14, 2015, 08:28:37 AM
Thanks Mr. Antes! Let's try the first first (so many visions...)
(Like it so much this *tickle tingle prickle*... Much better as if one does something that he understands...  :laugh: otherwise it could be even relaxed.)
Title: Re: Multilanguage Board Name/Descriptions
Post by: sangham.net on June 17, 2015, 07:46:34 PM
Works fine! To get it also for the indexes of topics and the child boards, the same action can be done in MessageIndex.template.php.

Category seems a little bit more complex. In regard of the link trees its also open. Thanks again, the "trick" really helps a lot.