Skip to content

Conversation

@studioTeaTwo
Copy link
Contributor

@studioTeaTwo studioTeaTwo commented Jan 3, 2018

related to #97

  • 訳注を2つ入れています。(余計な気もするから採用するかは判断お願いします。)
  • textlintのService WorkerルールにServiceWorkerModuleなどの固有名詞が引っかかります。

@lacolaco
Copy link
Collaborator

lacolaco commented Jan 4, 2018

textlintのService WorkerルールにServiceWorkerModuleなどの固有名詞が引っかかります。

Circle CIを見るとひっかかっているのは別の箇所のようですが、ローカルでひっかかりますか?
from ServiceWorker は残さないといけない文のようですので、textlintの無効化を導入したいと思います。
以下の対応を追加してもらえますか?

  • 最新のmasterにrebase
  • 該当部分を以下のコメントで挟む
<!-- textlint-disable prh -->
...
<!-- textlint-enable prh -->

@studioTeaTwo
Copy link
Contributor Author

VS codeのprhアドオン入れてチェックしてるとこんな感じです
2018-01-04 16 56 31

@lacolaco
Copy link
Collaborator

lacolaco commented Jan 4, 2018

なるほど、試しにprh.ymlのルールを次のように変えてみて変化を見てもらえますか?

  - expected: Service Worker
    pattern:
      - ServiceWorker
      - サービスワーカー
    options:
      wordBoundary: true

@studioTeaTwo
Copy link
Contributor Author

rebase済み(.textlintrc更新ずみ)かつphrにwordBoundary: true追加した結果です。

  • ServiceWorkerModuleはパスする
  • from ServiceWorkerはNGになる

2018-01-04 17 06 42

@lacolaco
Copy link
Collaborator

lacolaco commented Jan 4, 2018

期待通りの挙動になっていそうです。 from ServiceWorker の部分はdisableコメントで回避をお願いします 🙇

@lacolaco
Copy link
Collaborator

lacolaco commented Jan 4, 2018

prh.ymlへのdiffも含めていただいてOKです

@studioTeaTwo
Copy link
Contributor Author

パスしました🙆‍♂️

* `favicon.ico`
* ビルド成果物(JSおよびCSSバンドル)
* `assets`の下にあるもの(訳注:assets下にさらに階層を作っている場合は、`ngsw-config.json`の設定を階層に合わせて`/assets/**/**`などのように変えてください。)
* `assets`の下にあるもの
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

勘違いだったみたいなので削除しました。
(手元でキャッシュされなかったのですが、別の原因ぽく、現状はglobフォーマット通り/asset/**asset/images/hoge.pngなども読めてます。)



Beginning in Angular 5.0.0, you can easily enable Angular service worker support in any CLI project. This document explains how to enable Angular service worker support in new and existing projects. It then uses a simple example to show you a service worker in action, demonstrating loading and basic caching.
Angular 5.0.0から、どのCLIプロジェクトでもAngular Service Workerのサポートを簡単に有効にすることができます。このドキュメントでは、新規および既存のプロジェクトでAngular Service Workerのサポートを有効にする方法について説明します。次に、単純な例を使用して、Service Workerが実際に動作していることを確認し、読み込みとキャッシングの基本をデモで行います。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

デモで行います -> 実演します がよいでしょう

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。

1. Service Workerのパッケージを追加します。
2. CLIでService Workerのビルドサポートを有効にします。
3. Service Workerをインポートして登録します。
4. キャッシングビヘイビアなどの設定を指定するService Workerの設定ファイルを作成します。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

キャッシングビヘイビア => キャッシュの振る舞い がよいでしょう

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。

<code-example path="service-worker-getting-started/src/app/app.module.ts" linenums="false" title="src/app/app.module.ts" region="sw-module"> </code-example>

The file `ngsw-worker.js` is the name of the prebuilt service worker script, which the CLI copies into `dist/` to deploy along with your server.
`ngsw-worker.js`ファイルは、CLIがあなたのサーバーに一緒にデプロイするために`dist/`にコピーする、事前構築されたService Workerのスクリプト名称です。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

スクリプトの名前 でいいと思います

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

サーバーに一緒にデプロイするためにCLIがdist/にコピーする のほうが係り受けがわかりやすそうです

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。確かにその係り受けが自然ですね。翻訳は直訳の係り受けをいかに読み易くするかみたいなところありますね...。

Angular CLIには、`ngsw-config.json`というService Workerの設定ファイルが必要です。設定ファイルは、Service Workerがファイルおよびデータリソースをどのようにキャッシュするかを制御します。

You can begin with the boilerplate version from the CLI, which configures sensible defaults for most applications.
CLIからボイラープレート版を始めることができます。このボイラープレート版では、多くのアプリケーションで適切であろう推奨設定が行われています。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLIによるひな形を使って始めることができます

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました

### `http-server`を供給する

Because `ng serve` does not work with service workers, you must use a seperate HTTP server to test your project locally. You can use any HTTP server. The example below uses the [http-server](https://www.npmjs.com/package/http-server) package from npm. To reduce the possibility of conflicts, test on a dedicated port.
`ng serve`はService Workerでは機能しないので、プロジェクトをローカルでテストするためには、別個のHTTPサーバーを使用する必要があります。任意のHTTPサーバーを使用できます。次の例では、npmから[http-server](https://www.npmjs.com/package/http-server)パッケージを使用しています。競合する可能性を減らすために、専用ポートでテストしてください。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ng serveはService Workerと連携しないので`

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

別個の => 別の

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました

`ng serve`はService Workerでは機能しないので、プロジェクトをローカルでテストするためには、別個のHTTPサーバーを使用する必要があります。任意のHTTPサーバーを使用できます。次の例では、npmから[http-server](https://www.npmjs.com/package/http-server)パッケージを使用しています。競合する可能性を減らすために、専用ポートでテストしてください。

To serve with `http-server`, change to the directory containing your web files and start the web server:
`http-server`で供給するために、Webファイルが入っているディレクトリ(訳注:`ng build --prod`で作成されたフォルダ。通常なら`dist`)に移動し、Webサーバーを起動してください。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

サンプルコードで cd しているので、ここで訳注は不要かと思います。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

時間経って見直すと不要ですね。削除しました。

AngularにおけるService Workerを使用しないアプリケーションの場合、リフレッシュすると「インターネット接続がありません」と記載されたChromeのインターネット切断ページが表示されます。

With the addition of an Angular service worker, the application behavior changes. On a refresh, the page loads normally.
AngularにおけるService Workerを追加すると、アプリケーションの動作が変更されます。リフレッシュ時に、ページが正常にロードされます。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Angular Service Worker がよいでしょう

2. アプリケーションタブを閉じますが、ウィンドウは閉じません。これにより、開発者ツールも閉じる必要があります。

3. Shut down `http-server`.
3. `http-server`を落とします。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

シャットダウン にしましょう

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。

@lacolaco
Copy link
Collaborator

lacolaco commented Jan 7, 2018

翻訳ありがとうございます!いくつかの部分で修正をお願いします 🙇

<hr />

## More on Angular service workers
## もっとAngularにおけるService Workerを知りたい
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Angular Service Worker でよいでしょう

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。最初のintroduction.mdも修正PR上げます

@studioTeaTwo
Copy link
Contributor Author

@lacolaco レビューありがとうございました。修正をアップしました:bow:

@lacolaco
Copy link
Collaborator

lacolaco commented Jan 8, 2018

修正ありがとうございました!

@lacolaco lacolaco merged commit 3f0a66b into angular:master Jan 8, 2018
@studioTeaTwo studioTeaTwo deleted the translation/sw-start branch January 8, 2018 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants