Question: Title Slug In Arabic

Title Slug In Arabic

I am facing a problem when adding posts in Arabic. The slugs that are created automatically appear in the form of incomprehensible symbols and do not accept the inclusion of the publication

EH

Essam Husary

Asked

I am facing a problem when adding posts in Arabic. The slugs that are created automatically appear in the form of incomprehensible symbols and do not accept the inclusion of the publication because it does not contain text in the English language. How can I fix this problem and include the link in Arabic. I tried adding Arabic text in your experimental forum and the link was created in Arabic letters correctly, but I did not accept adding the post because the link did not contain an English letter. Please help me to solve this problem, thank you very much

  • MS

    Mian Saleem

    Answered

    Hello,

    Slug only work for English. You can modify the title_slug method of app/libraries/Tec.php as you need.

    To allow slug in other then English, you will need to edit themes/default/views/topics/add.php & edit.php and remove data-fv-regexp="true" data-fv-regexp-regexp="^[a-zA-Z0-9\_-]+$" from slug input.

    If you change to use Arabic then you might need to edit permitted_uri_chars in app/config/config.php too.

    Thank you

  • EH

    Essam Husary

    Answered

    Thanks For your replay. I’ll try and tell you the result.

  • EH

    Essam Husary

    Answered

    Mian Saleem Hello Mr mian as you describe i remove the data-fv-regexp=“true” data-fv-regexp-regexp=“^[a-zA-Z0-9_-]+$” from add and edit page. and remove value of permitted_uri_chars in app/config/config.php but still dose not recognize the arabic latter for slug is there is any thing else can do ?

  • MS

    Mian Saleem

    Answered

    Hello,

    Please take full screenshot of the page so that I can understand there error and page. If you can share the forum url that will be great.

    Thank you

  • MS

    Mian Saleem

    Answered

    Hello,

    Please update the base_url in the app/config/config.php to https:// and then try again.

    The auto slug will only work for English. There is no option to generate slug for Arabic. I have already mention method and files that are responsible for generating the slug.

    Thank you

  • EH

    Essam Husary

    Answered

    can we replace the slug for arabic letters with numbers ?

  • MS

    Mian Saleem

    Answered

    Hello,

    Please uncomment the lines at start of slug method of Tec.php and it should look like this after changes.

    public function slug($slug, $r = 1)
    {
        $slug = $this->slugify($slug);
        if (empty($slug)) {
            $this->load->helper('string');
            $this->slug(random_string('alnum', 16));
        }
        if ($this->settings_model->getTopicBySlug($slug)) {
            $slug = $slug . $r;
            $r++;
            $this->slug($slug, $r);
        }
        return $slug;
    }
    

    This will try to generate slug for Arabic and if failed random string will be used.

    Thank you

  • EH

    Essam Husary

    Answered

    https://www.loom.com/share/7c58159853474450923d5c8f1566a504

    Hello Mr. Main as you see when write title in arabic nothing happen just loading circle on the corner but nothing happen.

  • MS

    Mian Saleem

    Answered

    Hello,

    That might be due to error. You can check your server’s php error log for error details.

    Thank you

  • EH

    Essam Husary

    Answered

    should I change any thing in thing in database like data type ?

  • Login to Reply