Skip to content

Instantly share code, notes, and snippets.

@myakura
Last active August 29, 2015 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myakura/6d920770a4939b5deeb6 to your computer and use it in GitHub Desktop.
Save myakura/6d920770a4939b5deeb6 to your computer and use it in GitHub Desktop.

原文(とhash):https://github.com/html5rocks/www.html5rocks.com/blob/98bfd779eed44ceb0bd7f7912cc74160aeea1185/LOCALIZATION.md

Help us make HTML5Rocks more accessible to an international audience! We'd appreciate at least three kinds of help:

HTML5Rocksをもっと世界に広めるため協力をお願いします!まず、以下の3つは大歓迎です!

  • Proofreading existing translations: We're not experts in many languages beyond English (and, honestly, our mastery even there is debatable). If you can help us ensure that the translations on the site make good sense, and sound stylistically reasonable, we'd appreciate it. Likewise, if we've missed some strings in the site's UI, we'd like to know about it.
  • Translating whole articles: We've got a workflow running internally to get batches of articles translated, but it's going to take a while to get caught up. If you'd like to help out, we'd love you forever.
  • Support for additional languages: We've settled on English, German, Spanish, Japanese, Portugese, Russian, Korean and Chinese as the languages we're officially supporting. We might revisit that in the future based on demand, but that's where we're at right now. If you'd like to help us expand into languages beyond those 7, we'll happily accept article translations for any language at all. :)
  • いまある翻訳のproofreading★★★ ― 私達は英語以外の言語について詳しくありません(英語についても実際のところ疑わしいです)。サイト上の翻訳がちゃんと伝わるか、文体に問題がないか確認していただければ嬉しいです。同様に、サイトのUIで使われる言葉についても間違いがあれば指摘していただきたいです。
  • 記事の翻訳 ― 複数の記事を翻訳するワークフローがHTML5Rocks内部にあるのですが、全部を翻訳するまでには時間がかかってしまいます。もし記事を翻訳して助けていただけるなら、もうほんとに好きです★★★。
  • 他の言語版の追加 ― 現在、英語、ドイツ語、スペイン語、日本語、ポルトガル語、ロシア語、韓国語、中国語の記事を公開しています。ニーズに応じて他の言語版を追加するかもしれませんが、現時点ではこれが精一杯です。これ以外の言語に翻訳していただけるなら、どんな言語でも受け入れます :)

For all of these, we're pretty open to accepting contributions. If you see something that we really should rephrase, please open a new bug, and we'll make the fix. If you'd like to fork the project and make the fix yourself, we'd be happy to pull in your changes. Likewise, if you'd like to translate an article, simply send us a Pull Request!

これらについて、ご協力にはとても前向きに対応します★★★。これは修正すべきというフレーズがあれば、バグ報告をお願いします。直します。あなたがこのプロジェクトをフォークし自分で修正した場合は、喜んでpullします。記事を翻訳したい場合は、Pull Requestを送ってください!

Technical Details

ローカライズ方法の詳細

UI Strings

UIの文字列

Most of the static text you see on the site (text that's not directly related to an article) has been localized via the stock Django internationalization mechanisms. There's not really much to add to that documentation, so let's just call out a few relevant details:

HTML5Rocksのサイト上にある固定テキスト(記事に直接関係しないテキスト)は、Djangoの国際化機能を使ってローカライズされています。リンク先のドキュメンテーションに付け加えて言う事が特にないので、ローカライズに関連する箇所を列挙します。

  • Strings inside all the page templates should be wrapped in {% trans "[STRING]"} or {% blocktrans %}[LONGER, MULTILINE STRING]{% endblocktrans %} as appropriate. See /templates/tutorial.html for examples.
  • Strings inside Python code should be wrapped in _("[STRING]"). See main.py for examples.
  • Strings inside JavaScript are, at the moment, not localized. Avoid content inside JavaScript in favor of content inside HTML.
  • ページテンプレート内の文字列はすべて {% trans "文字列"} または {% blocktrans %}長い文や改行のある文章{% endblocktrans %} といったテンプレート用のブロックで囲むべきです。/templates/tutorial.html を参考にしてください。
  • Pythonコード内の文字列は _("文字列") という風に囲みます。main.py を参考にしてください。
  • JavaScript内の文字列は現時点でローカライズされていません。JavaScript内にテキストを書くのは避け、HTMLに書きましょう。

These strings are gathered up, and packaged into so-called "message files" by running make messages the base repo directory. One message file is written out per supported locale, and each lives at conf/locale/[LOCALE]/LC_MESSAGES/django.po. The English message file, for instance, is conf/locale/en/LC_MESSAGES/django.po. You can edit these files by hand, or you can use any of a number of programs specially designed for editing PO files. Poedit, for example, is free, and widely used.

レポジトリのベースディレクトリ上で make messages コマンドを実行すると、これらのローカライズされた文字列が集められ「メッセージファイル」と呼ばれるパッケージにまとまります。メッセージファイルはHTML5Rocksがサポートするロケールごとに conf/locale/[ロケール]/LC_MESSAGES/django.po というファイルになります★。たとえば、英語版のメッセージファイルは conf/locale/en/LC_MESSAGES/django.po です。これらのメッセージファイルは手動で編集できますし、POファイル編集ソフトを使っての編集もできます★。よく使われるPOファイル編集ソフトには、たとえば Poedit があります。

After changing PO files, you have to recompile them into the corresponding MO binary files: call make compile in the main repo directory. The Makefile makes assumptions about where your Google AppEngine/Django is installed - if it doesn't work, open Makefile and check the DJANGO_ROOT variable.

POファイルを変更した場合、関連するMOバイナリファイルをリコンパイルしなければいけません。レポジトリのメインディレクトリ上で make compile コマンドを実行してください。このMakefileは、Google AppEngine/Djangoのインストール先を固定しています★。もしコマンドがうまく実行されない場合は、Makefileを開き DJANGO_ROOT が正しいかどうか確認してくささい。

Articles

記事

Each article on the site lives in its own directory under /content that matches the slug in the URL. For instance, the URL http://www.html5rocks.com/en/mobile/touch/ maps to content/mobile/touch/ in the repository. Each localization of the article (including the original English version) lives inside a subdirectory, named for the locale. The Japanese version of that article is accessible on the web at http://www.html5rocks.com/ja/mobile/touch/, which maps to www.html5rocks.com/content/mobile/touch/ja/index.html on the filesystem.

HTML5Rocksの記事は /content 以下にある独自のディレクトリに保存されています。たとえば、http://www.html5rocks.com/en/mobile/touch/ はレポジトリの content/mobile/touch/ ディレクトリに対応します。記事の各言語版(オリジナルの英語版含む)はその直下にあるロケールの名前がサブディレクトリにあります。たとえば、日本語版の記事 http://www.html5rocks.com/ja/mobile/touch/ はレポジトリの www.html5rocks.com/content/mobile/touch/ja/index.html に対応します。

Localizing an article, then, is simply a matter of copying the English version of an article into a properly named subdirectory, and editing the text directly in that new file. Nothing special needs to be done to ensure that the system picks up on the new localization: if it's on the filesystem, it's available on the site.

記事の翻訳は、英語版の記事を適切なサブディレクトリにコピーしてその内容を編集するだけです。翻訳した記事をシステムに登録するといった作業は必要ありません。ディレクトリにファイルがあれば、それがサイトに現れます。

Article Metadata

記事のメタデータ

For historical reasons, article metadata (title, description, and so on) are not contained with the articles themselves, but live in the site's database. The information from the database is replicated into database/tutorials.yaml for backup purposes. This file must be kept up to date as new articles are added to the site.

歴史的な経緯から、記事のメタデータ(タイトル、概要など)は記事のファイルにはなく、サイトのデータベースにあります。データベースの情報はバックアップのため database/tutorials.yaml にコピーされています。このファイルは新しい記事が追加されたらその情報が反映されるようになっています★★★。

As part of the message file generation process, article titles and descriptions are extracted from this YAML file, and placed into the message files for translation. They can be edited in the same way as UI strings.

メッセージファイル生成プロセスの一環で、記事のタイトルや概要はこのYAMLファイルから抽出され、翻訳用のメッセージファイルにコピーされます★。これらの文字列も、UIの文字列と同じように編集します。

@myakura
Copy link
Author

myakura commented Feb 26, 2014

星マークは訳が不安なところです。★★★が「なおす!」ってとこ。★が「気になるけどこれでもよくないかなー」ってところです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment