Hello

September 07, 2010, 04:56:50 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?
Login with username, password and session length
What sNews Is: - sNews is a simple, basic, customizable CMS tool suitable for developers with beginner-to-advanced PHP skills. It is also useful to have a good working knowledge of how to work with, set up and manage MySQL databases. sNews is not - geared towards the end-user who knows little or nothing about building and developing PHP-MySQL based websites.
News: Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.
 
   Home   Help Search Login Register  
Pages: 1 2 [3] 4
  Print  
Author Topic: [MOD] Generate readable non-english SEF titles (sNews 1.6, 1.5)  (Read 12678 times)
codetwist
Hero Member
*****

Karma: 50
Posts: 955


« Reply #30 on: June 01, 2007, 10:04:21 PM »

Thx, rubenpol Wink
Logged
edsil
Jr. Member
**

Karma: 4
Posts: 92



« Reply #31 on: June 14, 2007, 06:08:57 PM »

ehmmm... sorry, but it doesnt work for me...  :/

First I installed a news fresh sNews version, then I turned to spanish configuration and then into the snews.php

I erased this:

Code:
// generate SEF urls
function genSEF(from,to) {
if (allowsef == true) {
var str = from.value.toLowerCase();
str = str.replace(/[^a-z 0-9]+/g,'');
str = str.replace(/\s+/g, "-");
to.value = str;
}
}
and put this:



Code:
   // generate SEF urls    
    function genSEF(from,to) {
        if (allowsef == true) {
            // MOD - 20070106 - Replaces characters specific to local language with available lowercase equivalent
            // Original code
            // var str = str.toLowerCase();
            var str = deLocalize(from.value);
            str = str.toLowerCase();
            // End of MOD - 20070106 - Replaces characters specific to local language with available lowercase equivalent
            //str = str.replace(/[^a-zA-Z 0-9]+/g,'');
            str = str.replace(/[^a-z 0-9]+/g,'');
            str = str.replace(/\s+/g, "-");        
            to.value = str;
        }
    }
and under this I put this:

Code:
function deLocalize( inStr ) {
        var outStr = inStr;
        outStr = outStr.replace(/[çÇ]/g, 'c');
        outStr = outStr.replace(/[üÜ]/g, 'u');
        outStr = outStr.replace(/[ïÏ]/g, 'i');
        outStr = outStr.replace(/[áÁ]/g, 'a');
        outStr = outStr.replace(/[àÀ]/g, 'a');
        outStr = outStr.replace(/[éÉ]/g, 'e');
        outStr = outStr.replace(/[èÈ]/g, 'e');
        outStr = outStr.replace(/[íÍ]/g, 'i');
        outStr = outStr.replace(/[óÓ]/g, 'o');
        outStr = outStr.replace(/[òÒ]/g, 'o');
        outStr = outStr.replace(/[úÚ]/g, 'u');
        return outStr;
    }
I validate, and create a new article using spanish characters:

El niño y el cajón (the boy and the box), and I get:

el nio y el cajn

 Sad

where is the error, do I need to do any other manipulation?

thanks for answers...
Logged
bramsyuur
sNews Dude
Hero Member
*****

Karma: 23
Posts: 899



WWW
« Reply #32 on: June 14, 2007, 08:14:56 PM »

Hi esdil,
First, remember to add into your "delocalized" strings this line:
Quote
outStr = outStr.replace(/[ñÑ]/g, 'n');
to get Ñ and ñ Smiley
And second, the most important thing, take care to save your current snews.php file in UTF-8 without BOM.
If you don't have a program to get this option, I suggest to you to use the free editor Notepad++ (really good in case that you're using window$) Here's the link: http://notepad-plus.sourceforge.net/es/site.htm
Logged

La comunidad sNews en tu idioma!
Comunidad sNews en Español
edsil
Jr. Member
**

Karma: 4
Posts: 92



« Reply #33 on: June 15, 2007, 10:18:32 AM »

Hola bramsyuur,

Thanks for the Notepad++ it works just fine... but I still have a problem...

So I create my article called "El niño y el cajón (the boy and the box)", and I get in the SEF: El nino y el cajon"... so all goes fine...  but it seems not to be recording into the data base... there is no article with this name into the data base and there is no article into my sNews site...
  Sad

I'm very sorry if I came with my problems...
Logged
Patric Ahlqvist
Nobodys perfect, but Im pretty effing close
Administrator
ULTIMATE member
******

Karma: 65
Posts: 4916


“I'm a self-made man and worships my creator.”


WWW
« Reply #34 on: June 15, 2007, 10:34:07 AM »

Another, and in my opinion better text editor (no offence Bram): http://www.crimsoneditor.com/
Logged

My sNews site
"It's only dead fish that goes with the flow... "
Updated, online again - Free designs
edsil
Jr. Member
**

Karma: 4
Posts: 92



« Reply #35 on: June 15, 2007, 01:19:07 PM »

Hello Patric!

Thanks a lot for your text editor, it is working just GREAT!  Cheesy
So no problem with SEF, data base or other... all goes fine now

Thanks to you all for kindy help Smiley
Logged
piXelatedEmpire
MIA
Thread Moderator
ULTIMATE member
*****

Karma: 37
Posts: 1456


currently MIA


« Reply #36 on: June 16, 2007, 03:03:09 AM »

ahhh yes, everyone loves crimson editor Cheesy
Logged

my apologies to the sNews crew, but I will be MIA for the forseeable future
Luka
Administrator
ULTIMATE member
******

Karma: 36
Posts: 1739


WWW
« Reply #37 on: September 18, 2007, 10:01:58 AM »

Croatian:

Code:
function deLocalize( inStr ) {
    var outStr = inStr;
    outStr = outStr.replace(/[ćĆ]/g, 'c');
    outStr = outStr.replace(/[čČ]/g, 'c');
    outStr = outStr.replace(/[đĐ]/g, 'dj');
    outStr = outStr.replace(/[šŠ]/g, 's');
    outStr = outStr.replace(/[žŽ]/g, 'z');
    return outStr;
}
Logged
codetwist
Hero Member
*****

Karma: 50
Posts: 955


« Reply #38 on: September 18, 2007, 07:38:43 PM »

Thx, Luka Wink
Logged
Vasile Rusnac
Newbie
*

Karma: 7
Posts: 49



« Reply #39 on: September 18, 2007, 08:27:59 PM »

Romanian
Code:
function deLocalize( inStr ) {
var outStr = inStr;
outStr = outStr.replace(/[ăĂ]/g, 'a');
outStr = outStr.replace(/[âÂ]/g, 'a');
outStr = outStr.replace(/[îÎ]/g, 'i');
outStr = outStr.replace(/[şŞ]/g, 's');
outStr = outStr.replace(/[ţŢ]/g, 't');

return outStr;
}

P.S. I love Notepad ++ editor  Grin
« Last Edit: September 18, 2007, 08:29:51 PM by Vasile Rusnac » Logged
codetwist
Hero Member
*****

Karma: 50
Posts: 955


« Reply #40 on: September 19, 2007, 10:16:38 PM »

Thx, Vasile  Wink
Logged
Aysseline
Jr. Member
**

Karma: 4
Posts: 66


« Reply #41 on: December 12, 2007, 01:29:43 PM »

Hi codetwist I've got a problem with this MOD. It works fine for sef title but make me a problem in admin panel with toogle function (I think)
Now when I click in each toogle menu nothing append I can't open any menus

My sef title version for french
Code:
#MOD generate SEF urls readable non-english
function genSEF(from,to) {
if (allowsef == true) {
var str = deLocalize(from.value);
str = str.toLowerCase();
str = str.replace(/[^a-z 0-9]+/g,'');
str = str.replace(/\s+/g, "-");
to.value = str;
}
}
function deLocalize( inStr ) {
    var outStr = inStr;
    outStr = outStr.replace(/[à]/g, 'a');
    outStr = outStr.replace(/[â]/g, 'a');
    outStr = outStr.replace(/[é]/g, 'e');
    outStr = outStr.replace(/[è]/g, 'e');
    outStr = outStr.replace(/[ê]/g, 'e');
    outStr = outStr.replace(/[ï]/g, 'i');
    outStr = outStr.replace(/[ô]/g, 'o');
    outStr = outStr.replace(/[ù]/g, 'u');
    outStr = outStr.replace(/[ü]/g, 'u');
    return outStr;
}
#MOD generate SEF urls readable non-english END

My toogle script, I don't change anything here
Code:
// toggle dynamic divs
// 1.6.0 - revised.
    function toggle(div) {
    var elem = document.getElementById(div);
    if (elem.style.display=='') {elem.style.display='none'; return;}
    elem.style.display='';
    }
// dependancy limiter
// 1.6.0 - revised.
function dependancy() {
var category = document.forms['post']['define_category'];
var page = document.getElementById('def_page');
page.style.display = category.options[category.selectedIndex].value == '-1' ? 'inline' : 'none';
}

When I revert with original code, all works but I don't have foreign sef title  Sad
Logged

sNews 1.6_patched - localhost, Xampp 1.6.2 - XPSP2
Aysseline
Jr. Member
**

Karma: 4
Posts: 66


« Reply #42 on: December 12, 2007, 02:15:49 PM »

Resolved ! my fault I put my comments like this:
# blabla

but it's in javascript need to be
// blabla
Logged

sNews 1.6_patched - localhost, Xampp 1.6.2 - XPSP2
codetwist
Hero Member
*****

Karma: 50
Posts: 955


« Reply #43 on: December 13, 2007, 08:28:22 AM »

Good Wink
Logged
sNews_RU
Newbie
*

Karma: 0
Posts: 2


WWW
« Reply #44 on: January 17, 2008, 11:13:04 PM »

In russian version by Eugeny (Reply #21) is disgraceful mistakes: incomplete russian alphabet and etc.

Use this by sNews_RU:

Code:
function deLocalize( inStr ) {
        var outStr = inStr;
        outStr = outStr.replace(/[аА]/g, 'a');
        outStr = outStr.replace(/[бБ]/g, 'b');
        outStr = outStr.replace(/[вВ]/g, 'v');
        outStr = outStr.replace(/[гГ]/g, 'g');
        outStr = outStr.replace(/[дД]/g, 'd');
        outStr = outStr.replace(/[еЕ]/g, 'e');
        outStr = outStr.replace(/[ёЁ]/g, 'yo');
        outStr = outStr.replace(/[жЖ]/g, 'zh');
        outStr = outStr.replace(/[зЗ]/g, 'z');
        outStr = outStr.replace(/[иИ]/g, 'i');
        outStr = outStr.replace(/[йЙ]/g, 'y');
        outStr = outStr.replace(/[кК]/g, 'k');
        outStr = outStr.replace(/[лЛ]/g, 'l');
        outStr = outStr.replace(/[мМ]/g, 'm');
        outStr = outStr.replace(/[нН]/g, 'n');
        outStr = outStr.replace(/[оО]/g, 'o');
        outStr = outStr.replace(/[пП]/g, 'p');
        outStr = outStr.replace(/[рР]/g, 'r');
        outStr = outStr.replace(/[сС]/g, 's');
        outStr = outStr.replace(/[тТ]/g, 't');
        outStr = outStr.replace(/[уУ]/g, 'u');
        outStr = outStr.replace(/[фФ]/g, 'f');
        outStr = outStr.replace(/[хХ]/g, 'h');
        outStr = outStr.replace(/[цЦ]/g, 'c');
        outStr = outStr.replace(/[чЧ]/g, 'ch');
        outStr = outStr.replace(/[шШ]/g, 'sh');
        outStr = outStr.replace(/[щЩ]/g, 'sh');
        outStr = outStr.replace(/[ъЪ]/g, '');
        outStr = outStr.replace(/[ыЫ]/g, 'y');
        outStr = outStr.replace(/[ьЬ]/g, '');
        outStr = outStr.replace(/[эЭ]/g, 'e');
        outStr = outStr.replace(/[юЮ]/g, 'yu');
        outStr = outStr.replace(/[яЯ]/g, 'ya');
        return outStr;
}
Logged

sNews_RU. Russian support
Simple decisions - decisions of the future... Excuse me for my English
Pages: 1 2 [3] 4
  Print  
 
Jump to:  

English Steel 1.6 © Saxon North Technologies
Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!