internationalization
emka opened this issue · 8 comments
Does it mean multilingualisation?
I think it can be realized by making .htacess like this:
AddDefaultCharset UTF-8 Options MultiViews LanguagePriority en de AddLanguage ca .ca AddLanguage cs .cz .cs AddLanguage da .dk AddLanguage de .de ..
Then, move "index.html" to "index.html.en". Translated version should be named as "index.html.xx". The "xx" means a language code. When a browser request index.html, apache automatically return the index.html of the browser's preferring language.
I have already made index.html.ja, and it works well with this method.
Yes, multilingualisation. There are a few ideas for translating the html part, I am still looking for an easy way to translate the javascript strings. Maybe the best way is to keep the strings in a separate JS file and add a translation JS file overwriting the strings to the translated html?
another way would be
http://recurser.com/articles/2008/02/21/jquery-i18n-translation-plugin/
Of course, I know there are messages to be translated in openstreetbugs.js. My idea for JS files is similar with the jquery-i18n. Add the following line in each index.html.xx.
<script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js" type="text/javascript"></script>
+<script src="client/lang/xx.js" type="text/javascript"></script>
<script src="client/map.js" type="text/javascript"></script>
Then, in the xx.js, define a message object. The following is for en.js:
var message={ 'create_error':'Create an Error Report', 'mess_create': 'Please provide a short description of what\'s wrong here. You can also enter your nickname to show that you found the error.', 'description' : 'Description', 'your_nickname': 'Your Nickname', 'mess_wait': 'Please wait while your error is submitted ...', ... 'permalink': 'Permalink', 'geofabric': 'Geofabrik Map' };
Finally, change openstreetbugs.js like this:
- var intro_text = '
Create an Error Report
Please provide a short description of what's wrong here. You can also enter your nickname to show that you found the error.
';+ var intro_text = '
'+message['create_error']+'
'+message['mess_create']+'
';You can write message.create_err instead of message['create_error']. As long as translated massages are written in UTF-8, you don't need to escape codes. I think collecting translations in wiki.openstreetmap.org is good way to keep letter codes in UTF-8, like as Potlatch.
Thanks for the input! I added translation support. Could you translate locale/empty.js to locale/ja.js?
Sorry. I could not get how to upload. I write it, here.
translation = { 'Feel free to put the modifications you would like to see on ' : '地図上の変更してもらいたい場所に自由にバグマーカを置いてください。', ' on the map.' : '地図上の', 'Read and get ' : 'もっと詳細は', 'more' : 'こちらへ', 'To add a bug, click at the desired spot in the map.' : 'バグを加えるには、地図上の望みの場所をクリックしてください。', 'According to the OpenStreetMap license, the data that you add on the map will be licensed ' : 'OpenStreetMap ライセンスによると、あなたがこの地図に加えたデータは、次のライセンスで使用許可されます: ', 'Do NOT use licensed data' : '著作権があるデータを置かないでください。', ' like paper maps, Google Maps, etc. Use only your knowledge of the reality or public domain data.' : '例えば、市販の紙の地図や Google Mapsのようなものは駄目です。あなたの知っている実際に存在している物体の情報か、パブリックドメインのデータだけにしてください。', 'Create an Error Report' : 'エラーレポートを作ってください。', 'Please provide a short description of what\'s wrong here. You can also enter your nickname to show that you found the error.' : 'ここの何がおかしいのかの短い説明を書いてください。エラーの発見者を示すために、あなたのニックネームも入れることができます。', 'Add a Comment' : 'コメントを追加', 'Add comment' : 'コメントを追加', 'Your Comment:' : '追加コメント', 'Mark as Fixed' : '修正済にする', 'Mark Error as Fixed' : 'エラーを修正済にする', 'Do you really want to mark this error as fixed? The error will be deleted after a week.' : '本当にエラーを修正済にしますか? このエラーは1週間後には消されます。', 'This error has been fixed already. However, it might take a couple of days before the map image is updated.' : 'このエラーは修正されました。しかし、地図イメージが更新されるまで、数日かかることがあります。', 'Unresolved Error' : '未解決エラー', 'Fixed Error' : '修正済エラー', 'Your Nickname:' : 'ニックネーム', 'Description:' : '説明', 'Comment:' : 'コメント', 'Edit in Potlatch' : 'Potlatchで編集', 'JOSM' : null, 'Yes' : 'はい', 'No' : 'いいえ', 'OK' : null, 'Cancel' : '取消', 'Please wait while your error is submitted ...' : 'あなたのエラーが登録されるまで、しばらくお待ちください ...', 'current view' : '現在の見ている範囲', 'RSS feed' : 'RSS フィード', 'Permalink' : 'パーマリンク', 'Geofabrik Map' : 'Geofabrik 地図', 'GPX export' : 'GPX エクスポート', ' (open bugs)' : null, // Do not delete the following line この行と前行のコンマを消さないで: }
Thank you.
Added. I think you missed some spaces, commas and dots. But you can test it yourself.
If your browser language is not "ja", just type "javascript:set_language('ja')" in the adress bar.
It works. Thank you.
It seems very strange though, could you change those two values?
'Feel free to put the modifications you would like to see on ' : '', ' on the map.' : '地図上の変更してもらいたい場所に自由にバグマーカを置いてください。',
This is for a problem of words order. the word "OpenStreetMap" should be top for Japanese.
Changed.
Btw. code will soon be changed such that index.html includes the first available language in Accept-Language header.
Translation support will be added to Translatewiki after normal website and Potlatch is done.