Skip to content

Commit a7e7def

Browse files
authored
fix: translate v19 update guide (#999)
1 parent 13495e0 commit a7e7def

File tree

2 files changed

+53
-23
lines changed

2 files changed

+53
-23
lines changed

Diff for: adev-ja/src/app/features/update/recommendations.ts

+15-15
Original file line numberDiff line numberDiff line change
@@ -2400,115 +2400,115 @@ export const RECOMMENDATIONS: Step[] = [
24002400

24012401
{
24022402
action:
2403-
'Angular directives, components and pipes are now standalone by default. Specify "standalone: false" for declarations that are currently declared in an NgModule. The Angular CLI will automatically update your code to reflect that.',
2403+
'Angularディレクティブ、コンポーネント、パイプはデフォルトでスタンドアロンになりました。現在NgModuleで宣言されている宣言には "standalone: false" を指定してください。Angular CLIは自動的にコードを更新します。',
24042404
level: ApplicationComplexity.Basic,
24052405
necessaryAsOf: 1900,
24062406
possibleIn: 1900,
24072407
step: '19.0.0-standalone-declarations',
24082408
},
24092409
{
24102410
action:
2411-
'Remove `this.` prefix when accessing template reference variables. For example, refactor `<div #foo></div>{{ this.foo }}` to `<div #foo></div>{{ foo }}`',
2411+
'テンプレート参照変数にアクセスする際にthis.プレフィックスを削除してください。例えば、`<div #foo></div>{{ this.foo }}``<div #foo></div>{{ foo }}`にリファクタリングしてください。',
24122412
level: ApplicationComplexity.Medium,
24132413
necessaryAsOf: 1900,
24142414
possibleIn: 1900,
24152415
step: '19.0.0-remove-this',
24162416
},
24172417
{
24182418
action:
2419-
'Replace usages of `BrowserModule.withServerTransition()` with injection of the `APP_ID` token to set the application `id` instead.',
2419+
'`BrowserModule.withServerTransition()`の使用を、アプリケーションの`id`を設定するための`APP_ID`トークンの注入に置き換えてください。',
24202420
level: ApplicationComplexity.Basic,
24212421
necessaryAsOf: 1900,
24222422
possibleIn: 1900,
24232423
step: '19.0.0-remove-browser-module-with-server-transition',
24242424
},
24252425
{
2426-
action: 'The `factories` property in `KeyValueDiffers` has been removed.',
2426+
action: '`KeyValueDiffers`の`factories`プロパティは削除されました。',
24272427
level: ApplicationComplexity.Advanced,
24282428
necessaryAsOf: 1900,
24292429
possibleIn: 1900,
24302430
step: '19.0.0-remove-key-value-differs-factories',
24312431
},
24322432
{
24332433
action:
2434-
'In angular.json, replace the "name" option with "project" for the `@angular/localize` builder.',
2434+
'angular.jsonで、`@angular/localize`ビルダーの"name"オプションを"project"に置き換えてください。',
24352435
level: ApplicationComplexity.Medium,
24362436
necessaryAsOf: 1900,
24372437
possibleIn: 1900,
24382438
step: '19.0.0_localize_builder_project_option',
24392439
},
24402440
{
2441-
action: 'Rename `ExperimentalPendingTasks` to `PendingTasks`.',
2441+
action: '`ExperimentalPendingTasks``PendingTasks`に名前変更します。',
24422442
level: ApplicationComplexity.Advanced,
24432443
necessaryAsOf: 1900,
24442444
possibleIn: 1900,
24452445
step: '19.0.0_rename_experimental_pending_tasks',
24462446
},
24472447
{
24482448
action:
2449-
"Update tests that relied on the `Promise` timing of effects to use `await whenStable()` or call `.detectChanges()` to trigger effects. For effects triggered during change detection, ensure they don't depend on the application being fully rendered or consider using `afterRenderEffect()`. Tests using faked clocks may need to fast-forward/flush the clock.",
2449+
"`Promise` のタイミングに依存していたエフェクトのテストを更新し、`await whenStable()` を使用するか、`.detectChanges()` を呼び出してエフェクトをトリガーするようにします。変更検出中にトリガーされるエフェクトについては、アプリケーションが完全にレンダリングされることに依存していないことを確認するか、`afterRenderEffect()` の使用を検討してください。フェイククロックを使用するテストでは、クロックを高速化/フラッシュする必要がある場合があります。",
24502450
level: ApplicationComplexity.Medium,
24512451
necessaryAsOf: 1900,
24522452
possibleIn: 1900,
24532453
step: '19.0.0.1',
24542454
},
24552455
{
2456-
action: 'Upgrade to TypeScript version 5.5 or later.',
2456+
action: 'TypeScriptバージョン5.5以降にアップグレードしてください。',
24572457
level: ApplicationComplexity.Basic,
24582458
necessaryAsOf: 1900,
24592459
possibleIn: 1900,
24602460
step: '19.0.0.2',
24612461
},
24622462
{
24632463
action:
2464-
'Update tests using `fakeAsync` that rely on specific timing of zone coalescing and scheduling when a change happens outside the Angular zone (hybrid mode scheduling) as these timers are now affected by `tick` and `flush`.',
2464+
'`fakeAsync` を使用したテストを更新します。変更がAngularゾーン外で発生した場合(ハイブリッドモードのスケジュール)、ゾーンの連結とスケジュールの特定のタイミングに依存するテストは、これらのタイマーが現在`tick``flush`の影響を受けるためです。',
24652465
level: ApplicationComplexity.Advanced,
24662466
necessaryAsOf: 1900,
24672467
possibleIn: 1900,
24682468
step: '19.0.0-timers-in-zone',
24692469
},
24702470
{
24712471
action:
2472-
"When using `createComponent` API and not passing content for the first `ng-content`, provide `document.createTextNode('')` as a `projectableNode` to prevent rendering the default fallback content.",
2472+
"`createComponent` API を使用し、最初の `ng-content` にコンテンツを渡さない場合、デフォルトのフォールバックコンテンツのレンダリングを防ぐために、`projectableNode` として `document.createTextNode('')` を指定してください。",
24732473
level: ApplicationComplexity.Medium,
24742474
necessaryAsOf: 1900,
24752475
possibleIn: 1900,
24762476
step: '19.0.0-render-default-fallback',
24772477
},
24782478
{
24792479
action:
2480-
'Update tests that rely on specific timing or ordering of change detection around custom elements, as the timing may have changed due to the switch to the hybrid scheduler.',
2480+
'カスタム要素周辺の変更検知の特定のタイミングまたは順序に依存するテストを更新します。ハイブリッドスケジューラへの切り替えにより、タイミングが変更されている可能性があるためです。',
24812481
level: ApplicationComplexity.Advanced,
24822482
necessaryAsOf: 1900,
24832483
possibleIn: 1900,
24842484
step: '19.0.0-hybrid-scheduler-timing',
24852485
},
24862486
{
24872487
action:
2488-
'Migrate from using `Router.errorHandler` to `withNavigationErrorHandler` from `provideRouter` or `errorHandler` from `RouterModule.forRoot`.',
2488+
'`Router.errorHandler`から`provideRouter`の`withNavigationErrorHandler`または`RouterModule.forRoot`の`errorHandler`へ移行します。',
24892489
level: ApplicationComplexity.Basic,
24902490
necessaryAsOf: 1900,
24912491
possibleIn: 1900,
24922492
step: '19.0.0-router-error-handler',
24932493
},
24942494
{
24952495
action:
2496-
'Update tests to handle errors thrown during `ApplicationRef.tick` by either triggering change detection synchronously or rejecting outstanding `ComponentFixture.whenStable` promises.',
2496+
'`ApplicationRef.tick`実行中に発生したエラーを、変更検知を同期的にトリガーするか、未処理の`ComponentFixture.whenStable` のPromiseを拒否することで処理するように、テストを更新します。',
24972497
level: ApplicationComplexity.Advanced,
24982498
necessaryAsOf: 1900,
24992499
possibleIn: 1900,
25002500
step: '19.0.0-testbed-error-handling',
25012501
},
25022502
{
2503-
action: 'Update usages of `Resolve` interface to include `RedirectCommand` in its return type.',
2503+
action: '`Resolve`インターフェースの使用を更新して、戻り値の型に`RedirectCommand`を含めます。',
25042504
level: ApplicationComplexity.Medium,
25052505
necessaryAsOf: 1900,
25062506
possibleIn: 1900,
25072507
step: '19.0.0-update-resolve-interface-return-type',
25082508
},
25092509
{
25102510
action:
2511-
'`fakeAsync` will flush pending timers by default. For tests that require the previous behavior, explicitly pass `{flush: false}` in the options parameter.',
2511+
'`fakeAsync`はデフォルトで保留中のタイマーをフラッシュします。以前の動作が必要なテストでは、オプションパラメーターに明示的に`{flush: false}`を渡してください。',
25122512
level: ApplicationComplexity.Advanced,
25132513
necessaryAsOf: 1900,
25142514
possibleIn: 1900,

Diff for: tools/translate.ts

+38-8
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,51 @@ Markdown形式のテキストを受け取り、テキスト中の英文を日本
4444

4545
async function main() {
4646
const args = parseArgs({
47-
options: { write: { type: 'boolean', default: false } },
47+
options: {
48+
text: { type: 'string', default: '', short: 't' },
49+
write: { type: 'boolean', default: false, short: 'w' },
50+
},
4851
allowPositionals: true,
4952
});
50-
const { write } = args.values;
53+
const { write, text } = args.values;
5154
const [target] = args.positionals;
52-
assert(target, 'ファイルまたはディレクトリを指定してください。');
5355

54-
const stats = await stat(target);
55-
if (stats.isFile()) {
56-
await translateFile(target, write);
57-
} else if (stats.isDirectory()) {
58-
await translateDir(target, write);
56+
if (text) {
57+
await translateText(text);
58+
} else {
59+
assert(target, 'ファイルまたはディレクトリを指定してください。');
60+
61+
const stats = await stat(target);
62+
if (stats.isFile()) {
63+
await translateFile(target, write);
64+
} else if (stats.isDirectory()) {
65+
await translateDir(target, write);
66+
}
5967
}
6068
}
6169

70+
async function translateText(text: string) {
71+
// Upload files for translation
72+
const prhFile = await fileManager.uploadFile(resolve(rootDir, 'prh.yml'), {
73+
mimeType: 'text/plain',
74+
displayName: 'prh.yml',
75+
});
76+
const translatedContent = await model
77+
.generateContent([
78+
{
79+
fileData: {
80+
mimeType: prhFile.file.mimeType,
81+
fileUri: prhFile.file.uri,
82+
},
83+
},
84+
`次のテキストを日本語に翻訳した結果を出力してください。\n`,
85+
text,
86+
])
87+
.then(({ response }) => response.text());
88+
89+
process.stdout.write(translatedContent);
90+
}
91+
6292
async function translateDir(dir: string, forceWrite = false) {
6393
const files = await glob('**/*.en.md', { cwd: dir });
6494
const selectedFiles = await consola.prompt(

0 commit comments

Comments
 (0)