Skip to content
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

translate 04-svelte-js-files.md and 01-what-are-runes.md #16

Merged
merged 1 commit into from
Jan 22, 2025
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
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
NOTE: do not edit this file, it is generated in apps/svelte.dev/scripts/sync-docs/index.ts
title: .svelte.js and .svelte.ts files
title: .svelte.js .svelte.ts ファイル
---

Besides `.svelte` files, Svelte also operates on `.svelte.js` and `.svelte.ts` files.
Svelte では、`.svelte` ファイル以外に、`.svelte.js` ファイルと `.svelte.ts` ファイルも処理します。

These behave like any other `.js` or `.ts` module, except that you can use runes. This is useful for creating reusable reactive logic, or sharing reactive state across your app.
これらは他の `.js` `.ts` モジュールと同じように振る舞いますが、Rune を使用することができます。これは、再利用可能なりアクティブロジックを作ったり、アプリ全体でリアクティブな state を共有するのに有用です。

> [!LEGACY]
> This is a concept that didn't exist prior to Svelte 5
> これは Svelte 5 より前には存在しないコンセプトです
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
---
NOTE: do not edit this file, it is generated in apps/svelte.dev/scripts/sync-docs/index.ts
title: What are runes?
title: Runeとは?
---

> [!NOTE] **rune** /ro͞on/ _noun_
>
> A letter or mark used as a mystical or magic symbol.
> 神秘的または魔術的なシンボルとして使用される文字やマーク。

Runes are symbols that you use in `.svelte` and `.svelte.js`/`.svelte.ts` files to control the Svelte compiler. If you think of Svelte as a language, runes are part of the syntax — they are _keywords_.
Rune は `.svelte` ファイルや `.svelte.js`/`.svelte.ts` ファイルで使用するシンボルで、Svelte コンパイラをコントロールします。Svelte を言語として考えるなら、Rune は構文の一部であり、キーワードです。

Runes have a `$` prefix and look like functions:
Rune には `$` 接頭辞があり、関数のように見えます:

```js
let message = $state('hello');
```

They differ from normal JavaScript functions in important ways, however:
しかし、これらは通常の JavaScript の関数とはいくつか重要な点で異なります:

- You don't need to import them — they are part of the language
- They're not values — you can't assign them to a variable or pass them as arguments to a function
- Just like JavaScript keywords, they are only valid in certain positions (the compiler will help you if you put them in the wrong place)
- インポートする必要はありません — これは言語の一部です
- 値ではありません — 変数に代入したり、関数の引数として渡すことはできません
- JavaScript のキーワードと同じように、特定の位置でのみ有効です (もし間違った位置に置いても、コンパイラが助けてくれます)

> [!LEGACY]
> Runes didn't exist prior to Svelte 5.
> Rune は Svelte 5 以前には存在しません。
Loading