Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Pages: 1 [2] 3

Author Topic: Generate readable non-english SEF for all languages  (Read 11713 times)

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Re: Generate readable non-english SEF for all languages
« Reply #15 on: April 30, 2008, 12:23:36 pm »

Here you are  ;D

 str = str.replace(/[\u0391\u03b1\u03ac\u0386]/g, 'a');  // αΑάΆ alpa
 str = str.replace(/[\u0392\u03b2]/g, 'b'); // βΒ beta
 str = str.replace(/[\u03b3\u0393]/g, 'g'); // γΓ gama
 str = str.replace(/[\u03b4\u0394]/g, 'd'); // δΔ delta
 str = str.replace(/[\u03b5\u0395\u03ad\u0388]/g, 'e'); // εΕέΈ epsilon
 str = str.replace(/[\u03b6\u0396]/g, 'z'); // ζΖ zita
 str = str.replace(/[\u03b7\u0397\u03ae\u0389]/g, 'i'); // ηΗήΉ eta
 str = str.replace(/[\u03b8\u0398]/g, 'th'); // θΘ theta
 str = str.replace(/[\u03b9\u0399\u03af\u038a]/g, 'i'); // ιΙίΊ iota
 str = str.replace(/[\u03ba\u039a]/g, 'k'); // κΚ kapa
 str = str.replace(/[\u03bb\u039b]/g, 'l'); // λΛ lamda
 str = str.replace(/[\u03bc\u039c]/g, 'm'); // μΜ mu
 str = str.replace(/[\u03bd\u039d]/g, 'n'); // νΝ nu
 str = str.replace(/[\u03be\u039e]/g, 'x'); // ξΞ xi
 str = str.replace(/[\u03bf\u039f\u03cc\u038c]/g, 'o'); // οΟόΌ omicron
 str = str.replace(/[\u03c0\u03a0]/g, 'p'); // πΠ pi
 str = str.replace(/[\u03c1\u03a1]/g, 'r'); // ρΡ rho
 str = str.replace(/[\u03c3\u03a3\u03c2]/g, 's'); // σΣς sigma
 str = str.replace(/[\u03c4\u03a4]/g, 't'); // τΤ tau
 str = str.replace(/[\u03c5\u03a5\u03cd\u038e]/g, 'y'); // υΥύΎ ypsilon
 str = str.replace(/[\u03c6\u03a6]/g, 'f'); // φΦ phi
 str = str.replace(/[\u03c7\u03a7]/g, 'ch'); // χΧ chi
 str = str.replace(/[\u03c8\u03a8]/g, 'ps'); // ψΨ psi
 str = str.replace(/[\u03c9\u03a9\u03ce\u038f]/g, 'o'); // ωΩώΏ omega
Logged

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: Generate readable non-english SEF for all languages
« Reply #16 on: April 30, 2008, 03:27:17 pm »

Thank you mosh, can you try now with new update?

Thank you Sibas, I had some chars from yesterday, can you try too?

Hafing ideia - done (choose option 1 or option 2)
« Last Edit: April 30, 2008, 04:04:22 pm by Rui Mendes »
Logged
Need a Job on Europe. Linkdin - Facebook / Group

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Re: Generate readable non-english SEF for all languages
« Reply #17 on: April 30, 2008, 04:31:45 pm »

For Greeks working just fine (tested)
Rui what chars you want me to see?
Logged

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: Generate readable non-english SEF for all languages
« Reply #18 on: April 30, 2008, 04:36:27 pm »

Just make some test: in lowecase and capital chars.

Thank you
Logged
Need a Job on Europe. Linkdin - Facebook / Group

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rdacteur Web
Re: Generate readable non-english SEF for all languages
« Reply #19 on: April 30, 2008, 06:22:15 pm »

Seems to work fine in french, Rui. :D

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: Generate readable non-english SEF for all languages
« Reply #20 on: April 30, 2008, 08:10:20 pm »

Seems to work fine in french, Rui. :D
Thank you Sven
Logged
Need a Job on Europe. Linkdin - Facebook / Group

hafing

  • Full Member
  • ***
  • Karma: 1
  • Posts: 174
Re: Generate readable non-english SEF for all languages
« Reply #21 on: April 30, 2008, 11:20:08 pm »

Thank you Rui it works just fine, just as expected.
But, I forgot one letter  :P
  small eth, Icelandic  ð  ð - replace it with d

it's eth () and should change to d.

live demo is here. www.sh.is/shafing  the site doesn't work 100% but I'm working on it.  ::)
 8)
« Last Edit: April 30, 2008, 11:45:26 pm by hafing »
Logged
I can be 2fast and 2curious

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: Generate readable non-english SEF for all languages
« Reply #22 on: May 01, 2008, 12:40:56 am »

  small eth, Icelandic  ð  ð - replace it with d
Done. Updated.

Find \xf0 and move from o to d line or download again.

Thank you hafing
Logged
Need a Job on Europe. Linkdin - Facebook / Group

mosh

  • Hero Member
  • *****
  • Karma: 77
  • Posts: 510
  • Awesome day :)
    • cms-zen
Re: Generate readable non-english SEF for all languages
« Reply #23 on: May 01, 2008, 01:08:58 am »

  8) Great job Rui,
i tested the recent update,
works very good  :D

+karma2u

awesome day

hafing

  • Full Member
  • ***
  • Karma: 1
  • Posts: 174
Re: Generate readable non-english SEF for all languages
« Reply #24 on: May 01, 2008, 02:59:17 am »

Rui Mendes.
You have once again done a great job. It works perfectly!!  ;D
Karma to you. ;D
 8)
Logged
I can be 2fast and 2curious

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Generate readable non-english SEF for all languages
« Reply #25 on: May 01, 2008, 06:14:29 pm »

A good mod for everyone.
Thank you Rui. K+
Logged

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: Generate readable non-english SEF for all languages
« Reply #26 on: June 04, 2008, 10:33:26 pm »

Sorry about my late response.

New update is for ISO-8859-5 - Cyrillic:
"Bulgarian, Byelorussian, Macedonian, Russian, Serbian and Ukrainian"

New update(red text)
Quote
// generate SEF url
   function genSEF(from,to) {
      if (allowsef == true) {
         var str = from.value.toLowerCase();
         str = str.replace(/[\xc0-\xc5\xe0-\xe5\u0100-\u0105\u0386\u0391\u03ac\u03b1\u0410\u0430\u05d0]/g,'a');
         str = str.replace(/[\xc8-\xcb\xe8-\xeb\u0116-\u011b\u0112\u0113\u0388\u0395\u03ad\u03b5\u042d\u044d]/g,'e');
//.... see first post for a complete code
         // -------------------------------
         str = str.replace(/[\u0401\u0451]/g,'io');
         str = str.replace(/[\u0402\u0452]/g,'dje');
         str = str.replace(/[\u0403\u0453]/g,'gje');
         str = str.replace(/[\u0404\u0415\u0435\u0454]/g,'ie');
         str = str.replace(/[\u0405\u0455]/g,'dze');
         str = str.replace(/[\u0406\u0418\u0419\u0438\u0439\u0456]/g,'i');
         str = str.replace(/[\u0407\u0457]/g,'yi');
         str = str.replace(/[\u0408\u0458]/g,'je');
         str = str.replace(/[\u0409\u0459]/g,'lje');
         str = str.replace(/[\u040a\u045a]/g,'nje');
         str = str.replace(/[\u040b\u045b]/g,'tshe');
         str = str.replace(/[\u040c\u045c]/g,'kje');
         str = str.replace(/[\u040e\u0423\u0443\u045d]/g,'u');
         str = str.replace(/[\u040f\u045d]/g,'dzhe');
         str = str.replace(/[\u0410\u0430]/g,'a');
         str = str.replace(/[\u0411\u0431]/g,'be');
         str = str.replace(/[\u0412\u0432]/g,'ve');
         str = str.replace(/[\u0413\u0433]/g,'ghe');
         str = str.replace(/[\u0414\u0434]/g,'de');
         str = str.replace(/[\u0416\u0436]/g,'zhe');
         str = str.replace(/[\u0417\u0437]/g,'ze');
         str = str.replace(/[\u041a\u043a]/g,'ka');
         str = str.replace(/[\u041b\u043b]/g,'el');
         str = str.replace(/[\u041c\u043c]/g,'em');
         str = str.replace(/[\u041d\u043d]/g,'en');
         str = str.replace(/[\u041e\u043e]/g,'o');
         str = str.replace(/[\u041f\u043f]/g,'pe');
         str = str.replace(/[\u0420\u0440]/g,'er');
         str = str.replace(/[\u0421\u0441]/g,'es');
         str = str.replace(/[\u0422\u0442]/g,'te');
         str = str.replace(/[\u0424\u0444]/g,'ef');
         str = str.replace(/[\u0425\u0445]/g,'ha');
         str = str.replace(/[\u0426\u0446]/g,'tse');
         str = str.replace(/[\u0427\u0447\u0447]/g,'che');
         str = str.replace(/[\u0428\u0448]/g,'sha');
         str = str.replace(/[\u0429\u042a\u0449]/g,'shcha');
         str = str.replace(/[\u042d\u044d]/g,'e');
         str = str.replace(/[\u042e\u044e]/g,'yu');
         str = str.replace(/[\u042f\u044f]/g,'ya');

         str = str.replace(/[^a-z 0-9]+/g,'');
         str = str.replace(/\s+/g, "-");
         to.value = str;
      }
   }

Can anyone try ?

« Last Edit: June 04, 2008, 10:57:53 pm by Rui Mendes »
Logged
Need a Job on Europe. Linkdin - Facebook / Group

tumu

  • Newbie
  • *
  • Karma: 0
  • Posts: 2
Re: Generate readable non-english SEF for all languages
« Reply #27 on: October 27, 2008, 11:28:32 am »

Turkish is OK. Tested on 1.7
Logged

izglioib

  • Guest
Re: Generate readable non-english SEF for all languages
« Reply #28 on: November 30, 2008, 10:55:28 pm »


I tried russian - replasing works but phonetics need to rewiev...

I fixed russian leters, but I don't know what to do with belorussian and ukrainian, sorry...

Code: [Select]
                str = str.replace(/[\u0401\u0451]/g,'io');
                str = str.replace(/[\u0402\u0452]/g,'dje');
                str = str.replace(/[\u0403\u0453]/g,'gje');
                str = str.replace(/[\u0404\u0415\u0435\u0454]/g,'e');
                str = str.replace(/[\u0405\u0455]/g,'dze');
                str = str.replace(/[\u0406\u0418\u0419\u0438\u0439\u0456]/g,'i');
                str = str.replace(/[\u0407\u0457]/g,'yi');
                str = str.replace(/[\u0408\u0458]/g,'je');
                str = str.replace(/[\u0409\u0459]/g,'lje');
                str = str.replace(/[\u040a\u045a]/g,'nje');
                str = str.replace(/[\u040b\u045b]/g,'tshe');
                str = str.replace(/[\u040c\u045c]/g,'kje');
                str = str.replace(/[\u040e\u0423\u0443\u045d]/g,'u');
                str = str.replace(/[\u040f\u045d]/g,'dzhe');
                str = str.replace(/[\u0410\u0430]/g,'a');
                str = str.replace(/[\u0411\u0431]/g,'b');
                str = str.replace(/[\u0412\u0432]/g,'v');
                str = str.replace(/[\u0413\u0433]/g,'g');
                str = str.replace(/[\u0414\u0434]/g,'d');
                str = str.replace(/[\u0416\u0436]/g,'zh');
                str = str.replace(/[\u0417\u0437]/g,'z');
                str = str.replace(/[\u041a\u043a]/g,'k');
                str = str.replace(/[\u041b\u043b]/g,'l');
                str = str.replace(/[\u041c\u043c]/g,'m');
                str = str.replace(/[\u041d\u043d]/g,'n');
                str = str.replace(/[\u041e\u043e]/g,'o');
                str = str.replace(/[\u041f\u043f]/g,'p');
                str = str.replace(/[\u0420\u0440]/g,'r');
                str = str.replace(/[\u0421\u0441]/g,'s');
                str = str.replace(/[\u0422\u0442]/g,'t');
                str = str.replace(/[\u0424\u0444]/g,'f');
                str = str.replace(/[\u0425\u0445]/g,'x');
                str = str.replace(/[\u0426\u0446]/g,'c');
                str = str.replace(/[\u0427\u0447\u0447]/g,'ch');
                str = str.replace(/[\u0428\u0448]/g,'sh');
                str = str.replace(/[\u0429\u042a\u0449]/g,'sh');
                str = str.replace(/[\u042d\u044d]/g,'e');
                str = str.replace(/[\u042e\u044e]/g,'yu');
                str = str.replace(/[\u042f\u044f]/g,'ya');

And there is missing letter 'ы'  it should be replased by 'i'

P.S. Rui Mendes, thank you wery much for all your work.
Logged

H.A.C

  • Jr. Member
  • **
  • Karma: 20
  • Posts: 86
  • i love snews community for its great members
    • Chasoft Corporation
Re: Generate readable non-english SEF for all languages
« Reply #29 on: January 07, 2009, 02:59:39 pm »

just a question, how could i get the decimal of a character, then I could convert to hex to apply as you guys do above

Quote
str = str.replace(/[\u041d\u043d]/g,'n');

I'd like to make a customized genSEF for my language by myself. Just show me the method, i'll do it myself!

below is for Vietnamese
Quote
ẻẺẽẼẹẸếẾềỀểỂễỄệỆ => e
ủỦũŨụỤưƯứỨừỪửỬữỮựỰ => u
ỉỈĩĨịỊ => i
ỏỎọỌơƠốỐồỒổỔỗỖộỘớỚờỜởỞỡỠợỢ => o
ảẢạẠăĂấẤầẦẩẨẫẪậẬắẮằẰẳẲẵẴặẶ => a
đĐ => d

Thanks

H.A.C
Logged
I'm not available ....until the end of the year 2009!
----------------------------
The largest website powered by sNews is in its way to become the biggest!
My great personal website powered by sNews 1.6
http://www.chasoft.net
Come to see how it's great!
Pages: 1 [2] 3