Jump to content

titleToUrlName


nikola
 Share

Recommended Posts

I've noticed that when using character "đ" (Croatian) in title name it doesn't convert to appropriate character in slug, rather it disappears.

The solution is to add matching substitute in wire/modules/Inputfield/InputfieldPageTitle/InputfieldPageTitle.js.

var str1 would contain character "đ" and matching substitute in var str2 would be "d".

More correct way would be that it is replaced by characters "dj", but variables are made to replace only single characters.

Other Croatian characters that are found also in other languages are substituting fine, because they already exist in variable str1.

Link to comment
Share on other sites

It's funny you should mention that because I just added ability for InputfieldPageTitle.js to convert single to multi-char about an hour ago. So we should be able to make it convert "đ" to "dj". Do you know if this is a fairly universal conversion? I'm not sure if this character appears in any other languages where it might be converted differently?

Link to comment
Share on other sites

  • 3 weeks later...

Hi Ryan, I have a request for adding transliteration of russian letters.

Could you add this to InputfieldPageTitle.js? (It seems like it's time for me to learn some Git :))

1 to 1 letters:

str1 = "абвгдеёзийклмнопрстуфыэ"
str2 = "abvgdeeziiklmnoprstufye"

1 to >1  letters:

srch = ['ж', 'х', 'ц', 'ч', 'ш', 'щ', 'ю', 'я']
repl = ['zh', 'kh', 'tc', 'ch', 'sh', 'shch', 'iu', 'ia']

ignored letters:

ъ, ь

The above matching is taken from the state standard for new passports ГОСТ Р 52535.1-2006

More info on Russian alphabet

It may seem strange but there isn't any universal standard for russian alphabet letters transliteration. So it may become handy to have this match tables switchable somewere in PW. It would allow to choose transliteration standard (also may be handy for different locales of the website as transliteration of the same letters, possibly, may vary from language to language).

Thank you!

Link to comment
Share on other sites

Sure, I'll be happy to add this. I've added it to my list here:

https://github.com/ryancramerdesign/P21/issues/51

So far I haven't come across any characters that need to be translated differently from language to language, but I've been wondering if they are out there. I'm guessing not, considering the relatively small scope of a-z 0-9 ascii. But if so, we will need to move this into a config option as you suggested (though we may do it either way).

Link to comment
Share on other sites

Thank you, Ryan.

Not sure about different transliteration in different langages, only assumed it. But  only for Russian language there are several standards of transliteration and also not standardized but very popular common transliteration format. So maybe it makes sense to take it out to a config option in future.

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 year later...

hi Ryan you can add also the transliteration of greek language if you want it.
 

there is also a drupal transliteration module with (i think) all languages, i do not know if this can help you

http://drupal.org/project/transliteration

thanks.

		'α' => 'a',
		'ά' => 'a',
		'αι' => 'ai',
		'αί' => 'ai',
		'αϊ' => 'aï',
		'αυ' => 'ay',
		'αύ' => 'ay',
		'β' => 'v',
		'γ' => 'g',
		'γγ' => 'gg',
		'γκ' => 'gk',
		'γχ' => 'gch',
		'δ' => 'd',
		'ε' => 'e',
		'έ' => 'e',
		'ει' => 'ei',
		'εί' => 'ei',
		'έι' => 'ei',
		'ευ' => 'ef',
		'εϊ' => 'eï',
		'ζ' => 'z',
		'η' => 'i',
		'ή' => 'i',
		'θ' => 'th',
		'ι' => 'i',
		'ί' => 'i',
		'κ' => 'k',
		'λ' => 'l',
		'μ' => 'm',
		'μπ' => 'mp',
		'ν' => 'n',
		'ντ' => 'nt',
		'ξ' => 'x',
		'ο' => 'o',
		'ό' => 'o',
		'οι' => 'oi',
		'οϊ' => 'oi',
		'οί' => 'oi',
		'ου' => 'oy',
		'οϋ' => 'oy',
		'ού' => 'oy',
		'π' => 'p',
		'ρ' => 'r',
		'σ' => 's',
		'ς' => 's',
		'τ' => 't',
		'υ' => 'y',
		'ύ' => 'y',
		'φ' => 'f',
		'χ' => 'ch',
		'ψ' => 'ps',
		'ω' => 'o',
		'ώ' => 'o',


 

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...