lfisher Posted September 7, 2006 Share Posted September 7, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/20021-help-with-content-negotiation-and-chinese-content/ Share on other sites More sharing options...
R_P Posted September 7, 2006 Share Posted September 7, 2006 Can you additionally post some of the configurations you've tried? It would help in troubleshooting in that I want to make sure something I recommend isn't something you've already tried verbatim! Quote Link to comment https://forums.phpfreaks.com/topic/20021-help-with-content-negotiation-and-chinese-content/#findComment-87978 Share on other sites More sharing options...
lfisher Posted September 7, 2006 Author Share Posted September 7, 2006 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,LeeAddLanguage ca .caAddLanguage cs .cz .csAddLanguage da .dkAddLanguage de .deAddLanguage el .elAddLanguage en .enAddLanguage en-us .enAddLanguage eo .eoAddLanguage es .esAddLanguage et .etAddLanguage fr .frAddLanguage he .heAddLanguage hr .hrAddLanguage it .itAddLanguage ja .jaAddLanguage ko .koAddLanguage ltz .ltzAddLanguage nl .nlAddLanguage nn .nnAddLanguage no .noAddLanguage pl .poAddLanguage pt .ptAddLanguage pt-BR .pt-brAddLanguage ru .ruAddLanguage sv .svAddLanguage zh .enAddLanguage zh-TW .enAddLanguage zh-CN .zh-CNAddLanguage zh-sg .enAddLanguage zh-HK .enLanguagePriority 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 onRewriteCond %{HTTP:Accept-Language} (zh-CN) [NC]RewriteCond %{REQUEST_URI} (.)*/company/press/releases/(.)*/RewriteCond %{REQUEST_FILENAME}/index.zh-CN -fRewriteRule ^((.)*)$ /$1/index.zh-CN Quote Link to comment https://forums.phpfreaks.com/topic/20021-help-with-content-negotiation-and-chinese-content/#findComment-88014 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.