blogo icon indicating copy to clipboard operation
blogo copied to clipboard

Permalink generation for other languages than English

Open diegosouza opened this issue 10 years ago • 2 comments

Let me give you an example:

"Educação" becomes "educa-o"

The field is editable but someone posting "Educação" would expect a permalink like "educacao". Since the application supports other languages, we should think about it.

My first idea was to replace letters like this:

var filteredString;

filteredString = postTitle.replace(/[àãáâ]/gi, 'a');
filteredString = filteredString.replace(/[ç]/gi, 'c');
filteredString = filteredString.replace(/[éêë]/gi, 'e');

// more filtering...

This approach is not great but works. The problem is that the patterns should be updated according to the new language additions. Also it wouldn't work for Esperanto, because "mesaĝo" should become "mesagxo" or "mesagho".

diegosouza avatar Jun 08 '14 21:06 diegosouza

It makes sense, thanks. I guess there supposed to be some libraries in JS for things like this.. It's even funnier with languages that use cyrillic (russian, ukranian).

greyblake avatar Jun 08 '14 22:06 greyblake

It seems to be a problem that will be easier to deal in future JS specifications. I haven't found a good library for this. If you find, let me know.

Take a look at this article. The best way I found. I could choose only portuguese symbols to be used by now.

diegosouza avatar Jun 08 '14 22:06 diegosouza