Jump to content

Help with content negotiation and chinese content?


lfisher

Recommended Posts

Hi,
We are having difficulties with serving Chinese content and in particular differentiating between the different language codes and serving up different content based on them.

Here are the requirements:
If browser specifies English, display English
If browser specifies zh-cn, display mainland Chinese page
If browser specifies ANY OTHER Chinese, including zh, zh-sg, zh-tw, etc, display ENGLISH page
If browser specifies German, Japanese, Korea, display the appropriate page
Any other pages should display English

The main area where we've been having trouble is with the Chinese, in particular the .zh case by itself, is difficult to control which language gets displayed.

We have tried several ways of doing, it, some of which work to different extents but are a bit kludgy.  I can add additional info with those, but is there a clean way to achieve our goal?  Please let me know if anyone can help.
Thanks,
Lee
Link to comment
Share on other sites

Thanks for the response.
I'll try to give some additional background.
Originally we were attempting to use AddLanguage in a way to force the behavior we wanted.
So we had httpd.conf settings similar to below.  Mainly we were trying to get the zh* languages to go to .en, except for zh-CN.  This seemed to work for some instances in scenarios, but was very inconsistent.  Too often it would fallback to the filesize "tiebreaker" and give incorrect results.  Additionally we even saw some instances where english requests would return german content (thus the attempt to adjust LanguagePriorities.)

The current approach we are taking is using mod-rewrite to explicitly handle any ZH-CN requests (see bottom of this post).  However this is more of a last resort and could have some performance implications, so we'd prefer to do everything directly in the content negotiation if it allows it.  We've also done a few tweaks in between, but they were mostly along the lines of the solutions mentioned.
Thanks,
Lee


AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage en-us .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage zh .en
AddLanguage zh-TW .en
AddLanguage zh-CN .zh-CN
AddLanguage zh-sg .en
AddLanguage zh-HK .en

LanguagePriority en en-us ca cs da el eo es et fr he hr it ja ko ltz nl nn no pl
pt pt-BR ru sv zh-TW zh-CN de

#
# ForceLanguagePriority allows you to serve a result page rather than
# MULTIPLE CHOICES (Prefer) [in case of a tie] or NOT ACCEPTABLE (Fallback)
# [in case no accepted languages matched the available variants]
#
ForceLanguagePriority Prefer Fallback

---MOD_REWRITE APPROACH----

RewriteEngine on
RewriteCond %{HTTP:Accept-Language} (zh-CN) [NC]
RewriteCond %{REQUEST_URI} (.)*/company/press/releases/(.)*/
RewriteCond %{REQUEST_FILENAME}/index.zh-CN -f
RewriteRule ^((.)*)$ /$1/index.zh-CN
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.