Jump to content

Spanish Collation


Recommended Posts

Hi All,

I want to display lists of words (utf8 encoded) correctly ordered in Spanish, where "ch" and "ll" are considered as letters in the alphabet.

For French, I use the following :

$col = new Collator('fr_FR');
$col->setAttribute(Collator::FRENCH_COLLATION, Collator::ON);
$col->asort(<array-to-sort>);

What would be the equivalent for spanish?

Thanks!

Link to post
Share on other sites

Well, so far, I tried nothing, as for spanish lists of words. It is just that googling terms like "SPANISH_COLLATION" gives no result.

For example, when properly ordered in Spanish, "lleno" would come after "lomo", and "chico" after "cosa", since the alphabet order in Spanish is "a, b, c, ch, d, ....k, l, ll, m, n, ...z"

 

Link to post
Share on other sites
1 minute ago, phdphd said:

Well, so far, I tried nothing,

Well that doesn't sound good. If you want your code to change then you'll have to try something.

1 minute ago, phdphd said:

as for spanish lists of words. It is just that googling terms like "SPANISH_COLLATION" gives no result.

Why are you going to Google when PHP has perfectly good documentation online?

Find out what FRENCH_COLLATION actually means and decide what to do with it.

1 minute ago, phdphd said:

For example, when properly ordered in Spanish, "lleno" would come after "lomo", and "chico" after "cosa", since the alphabet order in Spanish is "a, b, c, ch, d, ....k, l, ll, m, n, ...z"

That's nice but it doesn't help you find out what you have to do with your PHP code.

Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.