このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。

翻訳前ページへ


Simple Language Content 交渉 With 無視/無効

Simple Language Content 交渉 With 無視/無効

要約: This paper 詳細(に述べる)s a method for 達成するing "受託する-Language"-driven content 交渉 with Apache, while still permitting the 使用者 an 無視/無効 機械装置 which 固執するs from page to page, without the need for server-味方する scripting or a CMS.

1. Introduction

At one point, I was doing the website for two summer (軍の)野営地,陣営s I'm 伴う/関わるd with. (That 場所/位置 used to 論証する these techniques, but I no longer 持続する it and they are no longer using this 機械装置.) The 場所/位置 was pretty simple in construction, and made up of static HTML pages. Because the (軍の)野営地,陣営 is bilingual, we had a 必要物/必要条件 that the 場所/位置 be 利用できる in both English and French. No problem - we made two 見解/翻訳/版s of each page, and I 始める,決める up content 交渉 with a simple .htaccess とじ込み/提出する. However, いつかs people have mis-configured browsers, or have some other 推論する/理由 for wanting the 場所/位置 in a language other than the one their 受託する-Language header is advertising. And, if they make that choice, they want it to 固執する from page to page.

After much 長,率いる scratching and web searching, I 設立する an obscure page which 詳細(に述べる)d, at the end of a very long discussion, how to do it. This is a (hopefully more accessible) 要約 of the technique. I will use English (en) and French (fr) as my example, but this could be done with any languages.

2. Content 交渉

The first thing you do is create your content in two 見解/翻訳/版s - an English 見解/翻訳/版 of the content, and a French 見解/翻訳/版. How to do this is outside the 範囲 of this paper; I use a template 加える a 切り開く/タクシー/不正アクセスd-together Perl script which 取って代わるs tags with localised text from a strings とじ込み/提出する. Give the two 見解/翻訳/版s とじ込み/提出する 拡張s to match their language - e.g. .html.en for English. Use the 基準 指示/教授/教育s in the .htaccess in the root directory of your 場所/位置 to enable MultiViews and language-based content 交渉 for the languages in question.

3. 手動式の 無視/無効

You could have a 手動式の 無視/無効 on e.g. each English page by having a "en Fran軋is" linking 特に to the .fr とじ込み/提出する; however, this 無視/無効 wouldn't 固執する; when the 使用者 navigated away from that page - 受託する-Language 交渉 would take over again. 避けるing this would 要求する rewriting all of the links in the page dynamically to have a parameter or 拡張 示すing the language - and that 要求するs 複雑にするd server-味方する scripting support or a CMS.

Instead, you take advantage of the Apache mod_rewrite module, which 許すs server-味方する URL rewriting. Create two directories off the root, /en and /fr, whose only contents is a 選び出す/独身 .htaccess.

The .htaccess in the /en directory turns on FollowSymLinks and the Rewriting Engine, and then rewrites *.html とじ込み/提出するs to ../*.html.en. So, if you 接近 http://www.interaction-フラン.org/en/索引.html, the URL gets rewritten by the server to http://www.interaction-フラン.org/索引.html.en, and the English 見解/翻訳/版 of the content is returned. However, the URL in the 使用者's browser still remains as http://www.interaction-フラン.org/en/索引.html, and any その上の 航海 is 親族 to that, so the language choice 固執するs.

The .htaccess also rewrites all other URLs but without appending .en - this 許すs you to have graphics and other sorts of とじ込み/提出する which just live in a 選び出す/独身 place, but are used by both language 見解/翻訳/版s. The .htaccess in the /fr directory does 正確に/まさに the same thing but for French.

So, your "en Fran軋is" link on each page just 言及するs to the same URL but with /fr 挿入するd at the 前線.

This technique 課すs only one 制限 - links within your 場所/位置 must all be 親族. Any 絶対の link will break the persistence of the 使用者's language choice, because it will 除去する the /en or /fr prefix. Hey - it's swings and roundabouts.

In this way, with just the 新規加入 of a couple of .htaccess とじ込み/提出するs, and with no need for server-味方する scripting or other 複雑さs, you can 達成する both the (a)自動的な/(n)自動拳銃 serving of the 交渉するd language (訂正する in 99.9% of 事例/患者s) and a 手動式の 無視/無効 which 固執するs.

初めの URL: http://www.gerv.逮捕する/切り開く/タクシー/不正アクセスing/language-選択/