Angular i18n ソリューション
スタンドアロンコンポーネント、Signals、SSR をサポートする Angular アプリ向け。
Runtime translations in Angular, in three steps
Angular's built-in i18n compiles one bundle per locale. For translations that change without a rebuild, ngx-translate reads them from Better I18N at runtime.
Install the loader dependencies
ngx-translate provides the pipe, the service and the loader contract; core fetches and caches the messages.
npm install @ngx-translate/core @better-i18n/core
# @better-i18n/core ships zero dependencies —
# it is the same client our React SDKs are built on.Write a TranslateLoader backed by the CDN
TranslateLoader asks for an Observable per language, so rxjs from() around getMessages is the whole adapter.
import { Injectable } from '@angular/core'
import { TranslateLoader } from '@ngx-translate/core'
import { createI18nCore } from '@better-i18n/core'
import { from, Observable } from 'rxjs'
// Module scope: the 60s in-memory cache lives on the instance, so one
// client per app — not one per component.
const betterI18n = createI18nCore({
projectId: 'your-org/your-project', // Settings → General → Project ID
defaultLocale: 'en',
})
@Injectable({ providedIn: 'root' })
export class BetterI18nLoader implements TranslateLoader {
// TranslateLoader's contract: one Observable of messages per language.
getTranslation(lang: string): Observable<Record<string, unknown>> {
return from(betterI18n.getMessages(lang))
}
}
export { betterI18n }Provide it and switch at runtime
One provider in bootstrapApplication, then use() changes language with no page reload and no per-locale build.
import { bootstrapApplication } from '@angular/platform-browser'
import { importProvidersFrom } from '@angular/core'
import { TranslateModule, TranslateLoader } from '@ngx-translate/core'
import { AppComponent } from './app/app.component'
import { BetterI18nLoader } from './app/better-i18n.loader'
bootstrapApplication(AppComponent, {
providers: [
importProvidersFrom(
TranslateModule.forRoot({
defaultLanguage: 'en',
loader: { provide: TranslateLoader, useClass: BetterI18nLoader },
})
),
],
})How it works
Where an Angular string comes from
No per-locale bundle: the loader resolves a language at runtime and the edge answers it.
Read path — every locale load
The translate pipe reads what TranslateService already loaded.
0 network calls per render
getMessages(lang) inside the TranslateLoader — cached per language.
60s TTL · 0 deps
Cloudflare worker answers from the nearest edge cache.
max-age=60 · always 200
The published translation files the sync worker wrote.
source of truth
Fallback chain — tried in order when a hop fails
Write path — dashboard to app
Proposal reviewed in the dashboard, glossary enforced.
MCP · dashboard · CLI
Sync worker writes the locale files to R2.
better-i18n publish
Fire-and-forget purge of the affected keys and the manifest.
non-critical by design
The next getMessages() past the TTL returns the new copy.
~60s worst case
クイックスタート
パイプとサービスを使って Angular アプリに i18n を追加します。
import { Component, inject } from '@angular/core'
import { TranslateModule, TranslateService } from '@ngx-translate/core'
import { betterI18n } from './better-i18n.loader'
@Component({
selector: 'app-locale-switcher',
standalone: true,
imports: [TranslateModule],
template: `
<select (change)="switchTo($any($event.target).value)">
<option *ngFor="let l of languages" [value]="l.code">{{ l.name }}</option>
</select>
`,
})
export class LocaleSwitcherComponent {
private translate = inject(TranslateService)
languages: { code: string; name: string }[] = []
async ngOnInit() {
// Locales come from the project manifest, not a hardcoded array.
this.languages = await betterI18n.getLanguages()
}
switchTo(lang: string) {
// use() calls the loader, which hits the cache or the CDN.
this.translate.use(lang)
}
}In a template
The translate pipe and the service both read from the loader, so nothing in your components knows about the CDN.
<!-- app.component.html -->
<h1>{{ 'home.title' | translate }}</h1>
<p>{{ 'home.greeting' | translate: { name: 'World' } }}</p>
<!-- ICU plurals authored in the Better i18n dashboard -->
<p>{{ 'cart.items' | translate: { count: 3 } }}</p>
<app-locale-switcher />機能
人気のAngular i18nライブラリと連携
Better I18NはAngular i18nライブラリを補完します — 翻訳を視覚的に管理し、翻訳者と協力し、CDN経由でデプロイ。
Better I18N + @ngx-translate/core
最も広く使われているAngular翻訳ライブラリ。パイプ、ディレクティブ、サービスインジェクションによるランタイム翻訳。Better I18Nはngx-translate JSONフォーマットにエクスポート。ダッシュボードで翻訳を編集し、リポジトリに自動同期。
Better I18N + Angular i18n (built-in)
AOTコンパイル、ICU式、ビルド時翻訳抽出を備えたAngularの公式i18nシステム。Angular XLIFFフォーマットにエクスポート。Better I18Nが翻訳ワークフローを管理し、Angular CLIがlocale別バンドルをビルド。
Better I18N + Transloco
遅延ロード、豊富なプラグイン、優れたTypeScriptサポートを備えたAngular向けモダンで軽量なi18nライブラリ。Better I18NのGitHub連携でTransloco JSONフォーマットに翻訳を同期。CDN配信によるリアルタイム更新。
関連
他のフレームワークガイドを探す
Get started
Angular i18n で開発を始める
無料プランあり。クレジットカード不要。