<a id="memory"></a>

<a id="translation-memory"></a>

# 翻訳メモリ

Weblate に内蔵されている、翻訳メモリの項目:

* 手動でインポートした翻訳メモリ（参照: [ユーザー インターフェイス](#memory-user)）。
* Weblate が自動的に保存した翻訳（[翻訳メモリの使用範囲](#memory-scopes) による）。
* 自動的にインポートされた過去の翻訳。

翻訳メモリ内の語彙を文字列に適用する方法:

* ユーザーが、文字列の編集中に [自動提案](https://docs.weblate.org/ja/latest/user/translating.md#machine-translation) タブから提案を受け入れる。
* 選択した文字列を、Operations メニューから [自動翻訳](https://docs.weblate.org/ja/latest/user/translating.md#auto-translation) を使用して処理する。
* [自動翻訳](https://docs.weblate.org/ja/latest/admin/addons.md#addon-weblate-autotranslate-autotranslate) アドオンを使用して、新規および既存の文字列に変更を自動的に適用する。

インストール時の設定は、[Weblate 翻訳メモリ](https://docs.weblate.org/ja/latest/admin/machine.md#mt-weblate-translation-memory) を参照してください。翻訳メモリはデフォルトで有効です。

<a id="memory-scopes"></a>

## 翻訳メモリの使用範囲

翻訳メモリの使用範囲では、異なるプロジェクトやユーザーのプライバシーを保護します。翻訳の共有も利用可能です。

#### NOTE
When upgrading from older Weblate releases, existing translation-memory
entries are converted to scopes by a periodic Celery background task. Until
this backfill finishes, existing entries can be temporarily unavailable in
suggestions and memory management views. Keep Celery running after the
upgrade so the periodic task can start or resume the migration. Site
administrators can monitor the backfill and duplicate-entry consolidation in
Administration > Performance report.

### インポートした翻訳メモリ

[`import_memory`](https://docs.weblate.org/ja/latest/admin/management.md#weblate-admin-import_memory) コマンドを使用して、必要な翻訳メモリのデータをインポートすると、すべてのユーザーとプロジェクトがメモリの情報を使用できるようになります。

### ユーザーごとの翻訳メモリ

すべてのユーザーがした翻訳を、各ユーザーの個人翻訳メモリに自動保存します。

新規ユーザーのデフォルト値は、[翻訳メモリの自動整理](#autoclean-tm) の設定に基づいて自動的に調整されます。自動クリーンアップが有効な場合、不整合な翻訳が再び取り込まれるのを防ぐため、これはデフォルトで無効になります。

### プロジェクトごとの翻訳メモリ

プロジェクト内のすべての翻訳を、このプロジェクトでのみ使用可能なプロジェクト翻訳メモリに自動保存します。

Entries attributed to an existing restricted component are only available to
users who can access that component. This also applies when project memory is
downloaded or accessed using the REST API.

Legacy entries which can not be attributed to a current component use the
project access rules. This can happen when the component path has changed or
the component has been removed.

### Workspace translation memory

Projects in the same workspace can share translation memory without enabling
the global shared translation memory. Workspace translation memory has to be
enabled both in the workspace settings and in the individual project workflow
settings.

Entries attributed to an existing restricted component are only available to
users who can access that component, even when they can access another project
in the workspace. Unattributed legacy entries use the workspace access rules.

#### SEE ALSO
* [Use workspace translation memory](https://docs.weblate.org/ja/latest/admin/workspaces.md#workspace-use-workspace-tm)
* [Contribute to workspace translation memory](https://docs.weblate.org/ja/latest/admin/workspaces.md#workspace-contribute-workspace-tm)
* [Use workspace translation memory](https://docs.weblate.org/ja/latest/admin/projects.md#project-use-workspace-tm)
* [Contribute to workspace translation memory](https://docs.weblate.org/ja/latest/admin/projects.md#project-contribute-workspace-tm)

<a id="shared-tm"></a>

### 共有翻訳メモリ

All translations within projects with shared translation memory turned on
are stored in a shared translation memory available to all projects.
Turning off contribution to shared translation memory stops previously
contributed automatic entries from being used as shared suggestions.

Contributing to shared translation memory is an explicit publication action.
Project access control does not restrict the contributed source strings,
translations, or project and component origin. This also applies to
Private and Custom projects. Authenticated users can
enumerate the shared pool using the [memory API](https://docs.weblate.org/ja/latest/api.md#api-memory) without
knowing a source string in advance.

Restricted components do not contribute new entries to shared translation
memory.

This exclusion applies to shared translation memory entries. Saved automatic
translation add-ons and automation workflows can use eligible
restricted components directly as sources under add-on management authority.
See [アドオン](https://docs.weblate.org/ja/latest/admin/addons.md#addons) and [Workflow definition](https://docs.weblate.org/ja/latest/admin/automation.md#automation-workflows).

On Hosted Weblate, a project with restricted components can not enable shared
translation memory, and a component can not be restricted while its project
uses shared translation memory.

Unattributed legacy entries which are already in shared translation memory use
the shared translation memory access rules.

Weblate のインストールを共有する場合は、この機能を有効にするかどうかは慎重に検討してください。重大な影響を及ぼすことがあります。

* 翻訳したものは、他の誰でも使用できます。
* 秘密情報が漏洩するかもしれません。
* 共有する翻訳が高品質であることを確認してください。

#### SEE ALSO
* [共有翻訳メモリに貢献する](https://docs.weblate.org/ja/latest/admin/projects.md#project-contribute-shared-tm)
* [共有翻訳メモリの使用](https://docs.weblate.org/ja/latest/admin/projects.md#project-use-shared-tm)

<a id="memory-status"></a>

## 翻訳メモリの状態

#### Versionadded
Added in version 5.13.

Translation memory entries can have two different statuses: **active** and **pending**.
Pending entries are included in suggestions, but with a quality penalty applied.
Depending on the configured score threshold, the penalty can exclude even exact
matches from suggestions and automatic translation. Entries imported from
translation memory files are stored as active.
If [翻訳メモリの自動整理](#autoclean-tm) is enabled, matching pending entries are removed when a
translation becomes active.

<a id="autoclean-tm"></a>

## 翻訳メモリの自動整理

#### Versionadded
Added in version 5.13.

When enabled for a project, Weblate replaces older automatically created
translation memory entries when a translation becomes active:

* With [査読の有効化](https://docs.weblate.org/ja/latest/admin/projects.md#project-translation-review) enabled, cleanup happens when the
  translation is approved.
* Without review, cleanup happens as soon as the translation reaches the
  translated state.

For the same source string, component, context, and source/target language
pair, Weblate removes matching non-file entries from translation memory,
including entries with a different target text. This applies across personal,
project, and shared translation memory scopes. The current translation is then
stored again as an active entry in the scopes that are enabled for that change.

Entries imported from external translation memory files are not cleaned up
automatically. Entries with a different context are kept.

Docker コンテナでは、 [`WEBLATE_DEFAULT_AUTOCLEAN_TM`](https://docs.weblate.org/ja/latest/admin/install/docker.md#envvar-WEBLATE_DEFAULT_AUTOCLEAN_TM) を使用して設定します。

#### NOTE
自動クリーンアップを有効にすると、新しいユーザー プロファイルのデフォルト設定も、個人用翻訳メモリに貢献しないように変更されます。これにより、クリーンアップ対象だった不整合な翻訳が再び取り込まれるのを防ぎます。

#### SEE ALSO
[翻訳メモリの自動整理](https://docs.weblate.org/ja/latest/admin/projects.md#project-autoclean-tm)

## 翻訳メモリの管理

<a id="memory-user"></a>

### ユーザー インターフェイス

Translation memory can be managed from several places in the Weblate UI:

* Open the user menu and choose Translation memory to manage your
  personal translation memory.
* Open a project and choose Translation memory from the project menu
  to manage translation memory for that project.
* Open a workspace and choose Operations ↓
  Translation memory to manage automatically created translation
  memory for that workspace. Editing the workspace is required.
* Open Administration and choose Translation memory to
  manage uploaded translation memory for the whole Weblate instance.

The translation memory page shows entry counts for the selected scope. Depending
on the scope, it also lists entries by origin, component, or language pair. The
listed entries can be downloaded as JSON or TMX. Users with the required
permissions can delete entries, and the project view can rebuild translation
memory for the whole project or for individual components from the current
translations.

Removing a component preserves its automatically created translation memory by
default. This preserves the behavior of Weblate versions which did not track
the source component of translation-memory entries, and avoids unexpected data
loss when a component is removed or replaced.

Because the component access rule no longer exists after removal, retained
entries use the access rules of their remaining translation-memory scope. For
a restricted component, this can make retained entries visible to other members
of its project or workspace. Select
Delete translation memory created from this component in the
removal form when the entries should be removed with the component, especially
when its restricted content must remain unavailable after removal. Category
removal offers the equivalent option for every component in the category and
its nested categories.

The deletion option removes attributed entries and legacy entries matching the
current component path. It does not infer paths used before a component or
category rename or move. Such unmatched entries can be deleted by origin in the
project or workspace translation memory management, or using the REST API. The
REST API accepts the `delete_memory` boolean in the request body or query
string for component and category removal. Personal and uploaded entries are
preserved regardless of this option.

The project view also shows whether shared translation memory and autoclean
translation memory are enabled for the project, with a link to the project
workflow settings when the user can edit the project.

The workspace view can rebuild all currently contributing projects or an
individual contributing component. It manages workspace-scoped automatic
entries only. Translation-memory files cannot be uploaded into a workspace
scope.

Translation memory files can be imported on the same page. Uploaded files are
processed during the request, stored as active, and added to the selected scope:

* Personal uploads are available in your personal translation memory.
* Project uploads are available in the selected project's translation memory.
* Administration uploads are available as uploaded shared entries for the whole
  Weblate instance.

#### HINT
Translation memories in various formats can be imported into Weblate. The TMX
format is provided for interoperability with other tools. All supported
formats are TMX, JSON, XLIFF, PO, and CSV.

Source and target languages must be selected when uploading XLIFF, PO, or
CSV files if the language information is not provided by the file itself.

#### SEE ALSO
[Weblate Translation Memory Schema](https://docs.weblate.org/ja/latest/contributing/schemas.md#schema-memory)

![image](screenshots/memory.webp)

You can search translation memory while editing strings from the
[自動提案](https://docs.weblate.org/ja/latest/user/translating.md#machine-translation) tab.

### 管理画面

Administrative users have additional translation memory management controls.
In Administration > Translation memory, the page lists
uploaded shared entries, shared entries, and total entries for the Weblate
instance. Depending on permissions, it can import uploaded shared memory, delete
uploaded entries, and download uploaded, shared, or all entries as JSON or TMX.

#### Versionadded
Added in version 4.12.

The project translation memory view also allows rebuilding parts of or the
entire project translation memory. Automatically generated entries for the
selected component or project are deleted, and the memory is populated again
from the current translations in the background. Entries imported from files
are preserved.

### 管理画面

翻訳メモリの内容を操作するための管理コマンドは複数あります。管理コマンドは翻訳メモリ全体を操作し、使用範囲は制限されません（パラメータで指定しない限り) :

[`dump_memory`](https://docs.weblate.org/ja/latest/admin/management.md#weblate-admin-dump_memory)
: 翻訳メモリを JSON にエクスポート。

[`import_memory`](https://docs.weblate.org/ja/latest/admin/management.md#weblate-admin-import_memory)
: TMX または JSON ファイルを翻訳メモリにインポート。

[`cleanup_memory`](https://docs.weblate.org/ja/latest/admin/management.md#weblate-admin-cleanup_memory)
: 翻訳メモリから、保留状態のすべてのエントリを削除します。

#### Versionadded
Added in version 4.14.

Weblate API には翻訳メモリが含まれています。このため、さまざまな目的や翻訳サイクルのイベントに基づいて操作を自動化することができます。
