Skip navigation
Sidebar -

Advanced search options →

Welcome

Welcome to CEMB forum.
Please login or register. Did you miss your activation email?

Donations

Help keep the Forum going!
Click on Kitty to donate:

Kitty is lost

Recent Posts


Qur'anic studies today
by zeca
Today at 08:36 AM

What music are you listen...
by zeca
Today at 12:07 AM

France Muslims were in d...
Yesterday at 10:31 PM

Indian farmers protest
Yesterday at 10:43 AM

Nostalgia, nostalgia...
January 25, 2021, 07:44 AM

The Golden Age of Islam a...
January 24, 2021, 10:41 AM

NayaPakistan...New Pakist...
January 24, 2021, 09:28 AM

Random Islamic History Po...
by zeca
January 23, 2021, 05:28 PM

Kashmir endgame
January 21, 2021, 04:46 PM

AMRIKAAA Land of Free .....
January 20, 2021, 06:25 PM

Reading stabbings
January 15, 2021, 10:32 PM

Coronavirus crisis
January 15, 2021, 12:20 PM

Theme Changer

 Topic: Support for Arabic on the forum.

 (Read 11634 times)
  • 12 Next page « Previous thread | Next thread »
  • Support for Arabic on the forum.
     OP - July 05, 2008, 09:58 PM

    Aziz has been putting his programming skills to good use and has written some scripts that members of the forum may wish to use. There is a stickied thread in the "Questions, problems, suggestions" sub-forum with details of the scripts.

    The scripts themselves are attached to posts there but I'm re-posting them here with a brief description of each. If you have any questions about the use of these scripts please use the existing thread in QPS.

    Note that these will currently only work with Opera and Firefox. If you are using Firefox you will need to install the GreaseMonkey extension. If you are using Internet Explorer I recommend changing to Firefox as it is free and IMHO it is superior. If you are stuck with Internet Explorer for any reason I hope you have at least upgraded to IE7. Microsoft is making it available as a free upgrade.

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #1 - July 05, 2008, 10:00 PM

    This first script will give you direct links for all embedded videos if you wish to visit the source page for any reason, for instance to leave a comment or to rate the original video.

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #2 - July 05, 2008, 10:01 PM

    This script will bookmark all the threads you have recently visited and make links to them available in a sidebar on your screen. 

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #3 - July 05, 2008, 10:07 PM

    This script will enable you to post in Arabic.

    Now I'm wary of this one because I've seen people elsewhere basically preach in Arabic. If you are going to use this one you will be required to post a full and detailed English translation of any Arabic you post.

    English is the default language on this forum and the language that all members can read fluently. Posting in Arabic when necessary to make a specific point, and accompanying it with a translation for the rest of the members, is fine.

    Posting in Arabic as a method of obfuscation or to demonstrate your exclusiveness will not be tolerated and will be dealt with in the same manner as any other form of trolling. I hope Arabic speakers can understand the reasons for this and will not take offence.

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #4 - November 16, 2008, 12:32 AM

    Testing:  ğ

    Bugger. Doesn't work in threads.

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #5 - November 16, 2008, 12:39 AM

    ğ

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #6 - November 16, 2008, 12:43 AM

    It doesn't work because there is some code somewhere that escapes the ampersand in the numerical entity.

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #7 - November 16, 2008, 12:48 AM

    This is the offending code:
    function saveEntities()
    {
    var textFields = ["subject", "message", "guestname", "evtitle", "question"];
    for (i in textFields)
    if (document.forms.postmodify.elements[textFields[i]])
    document.forms.postmodify[textFields[i]].value = document.forms.postmodify[textFields[i]].value.replace(/&#/g, "&#");
    for (var i = document.forms.postmodify.elements.length - 1; i >= 0; i--)
    if (document.forms.postmodify.elements[i].name.indexOf("options") == 0)
    document.forms.postmodify.elements[i].value = document.forms.postmodify.elements[i].value.replace(/&#/g, "&#");
    }

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #8 - November 16, 2008, 12:50 AM

    <form action="http://www.councilofexmuslims.com/index.php?action=post2;start=0;board=26" method="post" accept-charset="UTF-8" name="postmodify" id="postmodify" onsubmit="submitonce(this);saveEntities();" enctype="multipart/form-data" style="margin: 0;">

    You could remove the call to saveEntities() in the onsubmit attribute. You have to find the php template for that.

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #9 - November 16, 2008, 12:50 AM

    Right. So if we mess with that what other dramas are likely to be created?

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #10 - November 16, 2008, 12:51 AM

    Finding the template wouldn't be too hard.

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #11 - November 16, 2008, 12:56 AM

    None, as far as I can see. It would just turn off the escaping of numerical entities. I don't see it having any negative effect on everything else.

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #12 - November 16, 2008, 01:00 AM

    Hmmm. Ok, but even if I do that all it'll mean is that people would have to type any UTF-8 characters in numerical entities to get them to display anyway. Bit of a pain.

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #13 - November 16, 2008, 01:08 AM

    No, you also have to update the submitThisOnce() function. Could have a bug though, but I'm not sure what it could be because it's so little code.

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #14 - November 16, 2008, 01:11 AM

    I could convert the whole damned place over to UTF-8 but the big things that bug me about it are a/ slightly slower load times (not a drama for people on broadband but........) and b/ support for all our mods that we have installed and c/ support for our themes.

    I can see it being a pain. You can enable "user-selectable language support" in admin but of course if you pick one you'll have to change back to the other when you want to use that.

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #15 - November 16, 2008, 01:18 AM

    Have you taken a close look at the HTML code? It's fucking horrible, at every place you see some javascript code, scattered here and there, and it get's downloaded every time a page is requested. A coder with half a brain would have put that code into a separate js file, that way the browser would only download the code in case it has changed (more precisely: when the timestamps differ.) There is a lot of potential in saving bandwidth and CPU load...

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #16 - November 16, 2008, 01:25 AM

    That sort of thing is out of my league anyway. I'm not an expert coder. I know there's js throughout the php templates but I have no idea why they chose to do it that way.

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #17 - November 16, 2008, 01:27 AM

    Btw none of this software is actually written in html. The whole damned lot is php, css and js.

    ETA:Of course it shows as html when you view the source code but that has nothing to do with what's loaded into the server.

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #18 - November 16, 2008, 01:36 AM

    Yeah, I know, one shouldn't confuse HTML or CSS code with code written in actual programming languages, like JavaScript, PHP, Python etc.

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #19 - November 16, 2008, 01:43 AM

    Ok, I have found the bug, need squash it now. Only a dead bug is a good bug, fact. Smiley

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #20 - November 16, 2008, 02:05 AM

    Test

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #21 - November 23, 2008, 12:02 AM

    This is a test post with index.english.php set as follows:

    $txt['lang_character_set'] = 'windows-1256';

    The text below is copy/pasted from this Wiki page.

    ?    ?    ?    ?    ?    ?
    ?    ?    ?    ?    ?    ?
    ?    ?    ?    ?    ?    ?
    ?    ?    ?    ?    ?
    ?    ?    ??    ?    ?

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #22 - November 23, 2008, 12:04 AM

    Now this is weird. Why does it work over at the demo forum but not on this one?  whistling2

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #23 - November 23, 2008, 12:09 AM

    Let's try that again. parrot

    This is a test post with index.english.php set as follows:

    $txt['lang_character_set'] = 'windows-1256';

    The text below is copy/pasted from this Wiki page.

    ?    ?    ?    ?    ?    ?
    ?    ?    ?    ?    ?    ?
    ?    ?    ?    ?    ?    ?
    ?    ?    ?    ?    ?
    ?    ?    ??    ?    ?

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #24 - November 23, 2008, 12:13 AM

    Who was the bastard that invented computers anyway?  finmad Tongue

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #25 - November 23, 2008, 01:48 AM

    Hey, I think it might be because of the "Content-Type" header sent by the server which overrides the content-type specified in the HTML document:

    E.g.: Content-Type: text/html; charset=UTF-8

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #26 - November 23, 2008, 02:51 AM

    I'm going to have to run a UTF-8 conversion I think. Damned if I know why SMF didn't make it the default setting. Bloody stupid and will mean a lot more work for me.

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • Re: Support for Arabic on the forum.
     Reply #27 - November 24, 2008, 12:13 PM

    I'm working on the problem again.

    The Arabic alphabet:
    ا    ب    ت    ث    ج    ح
    خ    د    ذ    ر    ز    س
    ش    ص    ض    ط    ظ    ع
    غ    ف    ق    ك    ل
    م    ن    ه‍    و    ي

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #28 - November 24, 2008, 12:23 PM

    So... Mr. Admin, it looks like I made it work. I used the Firebug extension for Firefox to insert the new JavaScript function and to edit the onsubmit attribute of the form tag. Then I copy&pasted the Arabic alphabet from Wikipedia and submitted the form. The Arabic letters got replaced by HTML numerical entities before the form was submitted to the server.

    You only have to do the following:

    Remove saveEntities(); from the onsubmit attribute of the form. Result: onsubmit="submitonce(this);"
    Then update the following function:
    function submitThisOnce(form)
    {
    // Hateful, hateful fix for Safari 1.3 beta.
    if (navigator.userAgent.indexOf('AppleWebKit') != -1)
    return !smf_formSubmitted;

    if (typeof(form.form) != "undefined")
    form = form.form;

    for (var i = 0; i < form.length; i++)
    {
    var element = form[i];
    if (typeof(element) != "undefined" && element.tagName.toLowerCase() == "textarea")
    {
    var new_text = textToEntities(element.value);
    if (new_text.length != element.value.length)
    element.value = new_text;
    element.readOnly = true;
    }
    }


    return !smf_formSubmitted;
    }

    German ex-Muslim forumMy YouTubeList of Ex-Muslims
    Wikis: en de fr ar tr
    CEMB-Chat
    I'm on an indefinite break...
  • Re: Support for Arabic on the forum.
     Reply #29 - November 24, 2008, 08:51 PM

    I'll test that one out. Will it also allow other scripts? I assume it isn't restricted to Arabic.

    Devious, treacherous, murderous, neanderthal, sub-human of the West. bunny
  • 12 Next page « Previous thread | Next thread »