Skip to content

Make "Getting Started" translatable and add its Japanese translation #1452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ collections:
permalink: /:collection/:path.html
books:
output: false
getting-started:
output: true
permalink: /:collection/:path.html
ja: # Japanese translations
output: true
permalink: /:collection/:path.html
Expand Down
2 changes: 1 addition & 1 deletion _data/doc-nav-header.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
url: "#"
submenu:
- title: Getting Started
url: "/getting-started.html"
url: "/getting-started/index.html"
- title: Tour of Scala
url: "/tour/tour-of-scala.html"
- title: Scala for Java Programmers
Expand Down
20 changes: 12 additions & 8 deletions getting-started.md → _getting-started/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---
layout: singlepage-overview
title: Getting Started
partof: getting-started
languages: [ja]
includeTOC: true

redirect_from: "/getting-started.html"
---

<div style="font-size: 1.25rem; color: #073642; font-weight: 400; font-family: 'Roboto Slab', serif; margin-bottom: 18px;"> There are <strong>two</strong> main ways people prefer to work in Scala.</div>
Expand Down Expand Up @@ -31,9 +35,9 @@ we'll walk you through downloading and setting up IntelliJ with the Scala
plugin, and we'll get you started with your first Scala project, complete with
unit tests!

* [Getting Started with Scala in IntelliJ](getting-started-intellij-track/getting-started-with-scala-in-intellij.html)
* [Building a Scala Project with IntelliJ and sbt](getting-started-intellij-track/building-a-scala-project-with-intellij-and-sbt.html)
* [Testing Scala in IntelliJ with ScalaTest](getting-started-intellij-track/testing-scala-in-intellij-with-scalatest.html)
* [Getting Started with Scala in IntelliJ](/getting-started/intellij-track/getting-started-with-scala-in-intellij.html)
* [Building a Scala Project with IntelliJ and sbt](/getting-started/intellij-track/building-a-scala-project-with-intellij-and-sbt.html)
* [Testing Scala in IntelliJ with ScalaTest](/getting-started/intellij-track/testing-scala-in-intellij-with-scalatest.html)


### If you prefer working on the command line...
Expand All @@ -42,8 +46,8 @@ If you prefer using a text editor like emacs, Vim, Atom, or Sublime Text, then
the best way to compile, test, and run Scala code is using _sbt_, Scala's build
tool.

* [Getting Started with Scala and sbt on the Command Line](getting-started-sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html)
* [Testing Scala with sbt and ScalaTest on the Command Line](getting-started-sbt-track/testing-scala-with-sbt-on-the-command-line.html)
* [Getting Started with Scala and sbt on the Command Line](/getting-started/sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html)
* [Testing Scala with sbt and ScalaTest on the Command Line](/getting-started/sbt-track/testing-scala-with-sbt-on-the-command-line.html)

<!-- sbt is the easiest way to ensure that your Scala project is reproducible;
you specify a Scala version, any libraries you depend on, and sbt takes care of
Expand All @@ -53,9 +57,9 @@ Scala project. -->
## Next Steps
Once you've finished these tutorials, check out

* [The Tour of Scala](tour/tour-of-scala.html) for bite-sized introductions to Scala's features.
* [Learning Resources](learn.html), which includes online interactive tutorials and courses.
* [Our list of some popular Scala books](books.html).
* [The Tour of Scala](/tour/tour-of-scala.html) for bite-sized introductions to Scala's features.
* [Learning Resources](/learn.html), which includes online interactive tutorials and courses.
* [Our list of some popular Scala books](/books.html).

## Getting Help
There are a multitude of mailing lists and real-time chat channels in case you want to quickly connect with other Scala users. Check out our [community](https://scala-lang.org/community/) page a list of these resources and where to reach out for help.
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
---
title: Building a Scala Project with IntelliJ and sbt
layout: singlepage-overview
partof: building-a-scala-project-with-intellij-and-sbt
languages: [ja]
disqus: true
previous-page: getting-started-intellij-track/getting-started-with-scala-in-intellij
previous-page: getting-started/intellij-track/getting-started-with-scala-in-intellij
next-page: testing-scala-in-intellij-with-scalatest

redirect_from: "/getting-started-intellij-track/building-a-scala-project-with-intellij-and-sbt.html"
---

In this tutorial, we'll see how to build a Scala project using [sbt](http://www.scala-sbt.org/1.x/docs/index.html). sbt is a popular tool for compiling, running, and testing Scala projects of any
Expand All @@ -15,7 +19,7 @@ or more than one code file.
## Creating the project
In this section, we'll show you how to create the project in IntelliJ. However, if you're
comfortable with the command line, we recommend you try [Getting
Started with Scala and sbt on the Command Line]({{site.baseurl}}/getting-started-sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html) and then come back
Started with Scala and sbt on the Command Line]({{site.baseurl}}/getting-started/sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html) and then come back
here to the section "Writing Scala code".

1. If you didn't create the project from the command line, open up IntelliJ and select "Create New Project"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
title: Getting Started with Scala in IntelliJ
layout: singlepage-overview
partof: getting-started-with-scala-in-intellij
languages: [ja]
disqus: true
next-page: building-a-scala-project-with-intellij-and-sbt

redirect_from: "/getting-started-intellij-track/getting-started-with-scala-in-intellij.html"
---

In this tutorial, we'll see how to build a minimal Scala project using IntelliJ
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
title: Testing Scala in IntelliJ with ScalaTest
layout: singlepage-overview
partof: testing-scala-in-intellij-with-scalatest
languages: [ja]
disqus: true
previous-page: building-a-scala-project-with-intellij-and-sbt

redirect_from: "/getting-started-intellij-track/testing-scala-in-intellij-with-scalatest.html"
---

There are multiple libraries and testing methodologies for Scala,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
title: Getting Started with Scala and sbt on the Command Line
layout: singlepage-overview
partof: getting-started-with-scala-and-sbt-on-the-command-line
languages: [ja]
disqus: true
next-page: testing-scala-with-sbt-on-the-command-line

redirect_from: "/getting-started-sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html"
---

In this tutorial, you'll see how to create a Scala project from
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
---
title: Testing Scala with sbt and ScalaTest on the Command Line
layout: singlepage-overview
partof: testing-scala-with-sbt-on-the-command-line
languages: [ja]
disqus: true
previous-page: getting-started-with-scala-and-sbt-on-the-command-line

redirect_from: "/getting-started-sbt-track/testing-scala-with-sbt-on-the-command-line.html"
---

There are multiple libraries and testing methodologies for Scala,
Expand Down
2 changes: 1 addition & 1 deletion _includes/sidebar-toc-singlepage-overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h5 class="contents">Contents</h5>
</ul>
{% elsif page.language %}
{% assign engPath = page.id | remove_first: "/" | remove_first: page.language | append: '.html' %}
{% assign engPg = site.overviews | where: 'partof', page.partof | first %}
{% assign engPg = site.documents | where: 'partof', page.partof | first %}
<ul id="available-languages" style="display: none;">
<li><a href="{{ site.baseurl }}{{ engPath }}">English</a></li>
{% for l in engPg.languages %}
Expand Down
52 changes: 52 additions & 0 deletions _ja/getting-started/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
layout: singlepage-overview
title: 入門
partof: getting-started
language: ja
includeTOC: true
---

<div style="font-size: 1.25rem; color: #073642; font-weight: 400; font-family: 'Roboto Slab', serif; margin-bottom: 18px;"> Scala で作業するには主に <strong>2通り</strong> の方法があります。</div>

1. IDE を使う
2. コマンドラインを使う

以下のチュートリアルでは、どちらかお好みの方法をセットアップする一連のプロセスを通して行っていきます。

ですが、もし何もインストールせずに直接 Scala に飛び込んでみたければ、このページのガイドは飛ばして、以下をチェックしてみましょう。

* [scala-exercises.com での Scala のインタラクティブな導入](https://www.scala-exercises.org/scala_tutorial/terms_and_types)
* [Scastie](https://scastie.scala-lang.org/)。ブラウザで動く Scalaで、すべての Scala コンパイラと公開されたライブラリにアクセス可能。

## Scala のセットアップ方法

### IDE が好きな人はこちら...

Intellij は、Scala 開発者にもっともよく使われている IDE です。
このチュートリアルでは、Intellij をダウンロードして Scala プラグインをセットアップするまでを通して行い、それから初めての Scala プロジェクトを開始して、ユニットテストを完了させます!

* [Intellij で Scala を始める](/ja/getting-started/intellij-track/getting-started-with-scala-in-intellij.html)
* [Intellij で sbt を使って Scala プロジェクトをビルドする](/ja/getting-started/intellij-track/building-a-scala-project-with-intellij-and-sbt.html)
* [Intelij で ScalaTest を使って Scala をテストする](/ja/getting-started/intellij-track/testing-scala-in-intellij-with-scalatest.html)


### コマンドラインが好きな人はこちら...

emacs、Vim、Atom、Sublime Text のようなテキストエディターの使用がお好みでしたら、Scala コードをコンパイル、テスト、実行する最良の方法は、**sbt**(Scala build tool) を使うことです。

* [コマンドラインの sbt で Scala を始める](/ja/getting-started/sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html)
* [コマンドラインで ScalaTest を使って Scala をテストする](/ja/getting-started/sbt-track/testing-scala-with-sbt-on-the-command-line.html)

## 次のステップ

このチュートリアルを終えたら、次をチェックしてみましょう。

* [Scala ツアー](/ja/tour/tour-of-scala.html)は、Scala の特徴を簡単に理解できるサイズで紹介します。
* [学習リソース](/learn.html)(英語のみ)は、オンラインのインタラクティブなチュートリアルや教材を紹介します。
* [Scala の人気書籍一覧](/books.html)(訳注:英語のみですが、邦訳されたものもあります)。

## ヘルプが必要な人は

他の Scala ユーザーとすばやくつながりたいとときには、メーリングリストやリアルタイムのチャットチャンネルがたくさんあります。
こうしたリソースや助けを求められる場所を一覧できる [community](https://scala-lang.org/community/) ページをチェックしてみてください。

Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
title: Intellij で sbt を使って Scala プロジェクトをビルドする
layout: singlepage-overview
partof: building-a-scala-project-with-intellij-and-sbt
language: ja
disqus: true
previous-page: /ja/getting-started/intellij-track/getting-started-with-scala-in-intellij
next-page: /ja/testing-scala-in-intellij-with-scalatest
---

このチュートリアルでは、[sbt](http://www.scala-sbt.org/1.x/docs/index.html) を使って Scala プロジェクトをビルドする方法を見ていきます。
sbtは、どのようなサイズの Scala プロジェクトでもコンパイル、実行、テストできる人気のツールです。
sbt(または Maven や Gradle)のようなビルドツールの使用は、1つ以上のコードファイルや依存関係のあるプロジェクトを作ったら、絶対不可欠になります。
[最初のチュートリアル](./getting-started-with-scala-in-intellij.html)を完了していることを前提とします。

## プロジェクトを作成
このでは、Intellij でプロジェクトの作り方をお見せします。
ですが、コマンドラインのほうが快適でしたら、[Getting
コマンドラインの sbt で Scala を始める](/ja/getting-started/sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html) を試して、「Scala コードを記述」節に戻ってくるのをおすすめします。

1. コマンドラインからプロジェクトを作っていなければ、Intellij を開き、"Create New Project" を選びます。
* 左パネルで Scala を選び、右パネルで sbt を選びます。
* **Next** をクリックします
* プロジェクトに **SbtExampleProject** と名前を付けます。
1. コマンドラインですでにプロジェクトを作成していたら、Intelij を開き、**Import Project** を選んで、あなたのプロジェクトの `build.sbt` ファイルを開きます。
1. **JDK version** が `1.8` で、**sbt version** が少なくとも `0.13.13` であることを確認します。
1. **Use auto-import** を選びます。すると依存関係が利用可能であれば自動でダウンロードされます。
1. **Finish** を選びます。

## ディレクトリ構造を理解

sbt は、より複雑なプロジェクトを構築すだしたら便利になるであろう多くのディレクトリを作成します。
今はそのほとんどを無視できますが、全部が何のためかをここでちらっと見ておきましょう。

```
- .idea (IntelliJ ファイル)
- project (sbt のプラグインや追加設定)
- src (ソースファイル)
- main (アプリケーションコード)
- java (Java ソースファイル)
- scala (Scala ソースファイル)
^-- 今はこれが必要なものの全てです
- scala-2.12 (Scala 2.12 固有ファイル)
- test (ユニットテスト)
- target (生成されたファイル)
- build.sbt (sbt のためのビルド定義ファイル)
```


## Scala コードを記述
1. 左の **Project** パネルで、`SbtExampleProject` => `src` => `main` を展開します。
1. `scala` を右クリックし、**New** => **Package** を選択します。
1. パッケージに `example` と名前をつけ、**OK** をクリックします。
1. パッケージ `example` を右クリックし、**New** => **Scala class** をクリックします。
1. クラスに `Main` と名前をつけ、**Kind** を `object` に変更します。
1. クラスのコードを次おように変更します。

```
object Main extends App {
val ages = Seq(42, 75, 29, 64)
println(s"The oldest person is ${ages.max}")
}
```

注:Intellij は Scala コンパイラーの独自実装を持っており、コードが間違っていると Intellij が示しても正しい場合がときどきあります。
コマンドラインで sbt がプロジェクトを実行できるかを常にチェックできます。。

## プロジェクトを実行
1. **Run** メニューから、**Edit configurations** を選びます。
1. **+** ボタンをクリックし、**sbt Task** を選びます
1. それに `Run the program` と名付けます。
1. **Tasks** フィールドで、`~run` と入力します.
`~` は、プロジェクトファイルへの変更を保存するたびに sbt にプロジェクトを再ビルド、再実行させます。
1. **OK** をクリックします。
1. **Run** メニューで、**Run 'Run the program'** をクリックします。
1. コードの `75` を `61` に変えて、コンソールで更新された出力を見ます。

## 依存関係を追加

趣向を少し変えて、アプリに追加機能を加えるために公開ライブラリの使い方を見てみましょう。

`build.sbt` を開き、以下のファイルを追加します。

```
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.0"
```

ここで `libraryDependencies` は依存関係の集合であり、`+=` を使うことにより、[scala-parser-combinators](https://github.com/scala/scala-parser-combinators) への依存を、sbt が起動時に取得してくる依存関係の集合に加えています。
これで、どの Scala ファイルでも、`scala-parser-combinator` にあるクラスやオブジェクトなどを通常のインポートでインポートできます。

さらなる公開ライブラリは、Scala ライブラリインデックス [Scaladex](https://index.scala-lang.org/) で見つけられます。
そこでは上述のような依存関係情報をコピーでき、`build.sbt` ファイルにペーストできます。

## 次のステップ

**Intellij で入門** シリーズの次のチュートリアルに進み、[Intelij で ScalaTest を使って Scala をテストする](testing-scala-in-intellij-with-scalatest.html)方法を学びます。

**あるいは**

- インタラクティブなオンラインコース [Scala Exercises](https://www.scala-exercises.org/scala_tutorial) で Scala を学習します。
- [Scala ツアー](/ja//tour/tour-of-scala.html) で Scala の特徴を一口大のサイズでステップバイステップに学びます。
Loading