Dashboard i18n Translation Dictionary
Comprehensive translation system for CIA Intelligence Dashboard supporting 14 languages. Provides language-specific translations for UI text, error messages, data labels, and cultural formatting (dates, numbers) using the Intl API.
Supported Languages
- Nordic: English (en), Swedish (sv), Danish (da), Norwegian (no), Finnish (fi)
- European: German (de), French (fr), Spanish (es), Dutch (nl)
- Middle Eastern: Arabic (ar), Hebrew (he)
- East Asian: Japanese (ja), Korean (ko), Chinese Simplified (zh)
Translation Categories
- System Messages: Loading states, errors, retry actions
- Political Terminology: Party names, risk levels, roles
- UI Labels: Section headings, metrics, chart labels
- Cultural Formatting: Date/time formats, number formats
Usage Example
import { t, formatDate, formatNumber } from './i18n-translations.js';
// Simple translation
const loadingText = t('loadingData'); // "Loading CIA intelligence data..."
// Nested translation
const partyName = t('parties.M'); // "Moderate Party"
// Cultural formatting
const formattedDate = formatDate(new Date(), 'sv'); // "13 februari 2026"
const formattedNumber = formatNumber(12345.67, 'de'); // "12.345,67"
- Version:
- 1.0.0
- Since:
- 2026-02-13
- License:
- Apache-2.0
- Source:
Members
(inner, constant) LOCALE_MAP
Locale mappings for Intl API
- Source:
Methods
(static) detectLanguage() → {string}
Detect current page language from document.documentElement.lang
- Source:
Returns:
Language code (en, sv, da, etc.)
- Type
- string
(static) formatCurrency(amount, langopt) → {string}
Format currency (SEK) with cultural awareness
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
amount |
number | Amount to format |
|
lang |
string |
<optional> |
Language code |
- Source:
Returns:
Formatted currency
- Type
- string
(static) formatDate(date, langopt) → {string}
Format date with cultural awareness
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
date |
Date | string | Date to format |
|
lang |
string |
<optional> |
Language code |
- Source:
Returns:
Formatted date
- Type
- string
(static) formatNumber(num, langopt, optionsopt) → {string}
Format number with cultural awareness
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
num |
number | Number to format |
|
lang |
string |
<optional> |
Language code |
options |
Object |
<optional> |
Intl.NumberFormat options |
- Source:
Returns:
Formatted number
- Type
- string
(static) formatPercentage(num, langopt) → {string}
Format percentage with cultural awareness
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
num |
number | Number to format as percentage (0-1 range, e.g., 0.5 for 50%) |
|
lang |
string |
<optional> |
Language code |
- Source:
Returns:
Formatted percentage
- Type
- string
(static) t(key, langopt) → {string}
Get translation for a key
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
key |
string | Translation key (supports dot notation like 'parties.M') |
|
lang |
string |
<optional> |
Language code (defaults to auto-detected) |
- Source:
Returns:
Translated text
- Type
- string