Support for multiple languages!

Started by olari9, March 16, 2016, 06:48:04 AM

Previous topic - Next topic

olari9

Hey guys. Since I do not know, where else to put this post, I am putting it here, since it is SMF Coding Discussions. I have searched from mods section for a mod like that, but I haven't found it.

Since I am owning a website for multiple people, from my own country and mostly for people who speak english. I would like there to be a choice of language. The translation mods dont really work with my needs, since the translation is rough and not really correct. So, basically said, I would like to have a mod, where people can choose a language, they want the forum to be in. Not just the forum itself, but the posts aswell. So the idea is, if a user registers, he/she has a choice of language, the forum and everything will be in that certain language, they have chosen. Posts aswell. The way it can be done is, that if a person has chosen the certain language, he will only be shown the text in their language (That is if translated). So first it should detect users language and if the certain post has a language filter in it. Language filtering can be done with BBCodes. For instance, I as an administrator will create a post:
" [language=EE]Tere, see on test[/language]
[language=EN]Hi, this is a test[/language]
[language=RU]привет, это тест[/language]
"
Now if the viewing user has chosen to have estonian as their forum language, they will only be shown the first part of the text, aka the one with [language=EE][/language] BBCode thingie, if a person , who has chosen english as their forums language, they will only see the 2nd one, and 3rd one is obviously for russians.
Tell me, if someone is willing to work on such a thing or no? I would be really greatful, if so.
And if you have any questions about this topic, please, feel free to ask.

thank you :)

JBlaze

Jason Clemons
Former Team Member 2009 - 2012

Illori

Quote from: JBlaze on March 20, 2016, 01:18:09 PM
I think you're looking for something like this? http://custom.simplemachines.org/mods/index.php?mod=598

that does not let you translate posts/topics that users post. i dont believe there is any mod available to do so.

JBlaze

Quote from: Illori on March 20, 2016, 02:29:47 PM
that does not let you translate posts/topics that users post. i dont believe there is any mod available to do so.

In that case, it's easier to just use Google Chrome and/or a browser extension.
Jason Clemons
Former Team Member 2009 - 2012

dougiefresh

That looks like a simple mod to build....  I'll see what I can do.

dougiefresh

Okay, this one is a little too simple for a mod (in my opinion).  In Sources/Subs.php, look for this:
Code (Find) Select

array(
'tag' => 'left',
'before' => '<div style="text-align: left;">',
'after' => '</div>',
'block_level' => true,
),

Add this before that:
Code (Add Before) Select

array(
'tag' => 'language',
'type' => 'unparsed_commas_content',
'content' => '',
'validate' => create_function('&$tag, &$data, &$disabled', '
global $txt;
if (empty($data[1]) || strtolower($txt["lang_dictionary"]) == strtolower($data[1]))
$tag["content"] = parse_bbc($data[0]);
'),
),

The form to use with this bbcode is what you specified:

[language=EN]blah blah blah[/language]

Case of the language is not important, however, language designation is.  "English" will not work in place of "EN".....

dougiefresh

I've given it a little more thought.  This needs more code in order to be effective....  I'm gonna expand on my code that I presented in the last post so that a default language can be specified, and package it as a mod....

dougiefresh


dougiefresh

Apologies to all for reviving this thread from last year, but I had forgotten to mention that the Show Specified Language has been approved....

Advertisement: