Skip to content

Language Commands

Language commands manage the multilingual configuration of your FORGE project — adding and removing locales, setting the default language, and synchronizing translation strings across the backend and frontend.

forge lang:add

Add a new language to the project.

Usage

bash
forge lang:add <CODE> [OPTIONS]

Options

OptionTypeDefaultDescription
CODEstringISO 639-1 language code (e.g. ar, fr, de).
--namestringAuto-detectedEnglish name of the language.
--nativestringAuto-detectedNative name of the language (e.g. العربية for Arabic).
--directionstringltrText direction: ltr (left-to-right) or rtl (right-to-left).
--defaultflagfalseSet this language as the project default.

Examples

bash
# Add Arabic with RTL support
forge lang:add ar --direction=rtl

# Add French as the new default language
forge lang:add fr --default

When a language is added, FORGE updates forge.yaml, generates translation stubs for existing keys, and updates the database seeder for the languages table.

TIP

FORGE auto-detects the language name, native name, and direction for common ISO 639-1 codes. You only need to specify these options for custom or uncommon locales.


forge lang:remove

Remove a language from the project.

Usage

bash
forge lang:remove <CODE>

Example

bash
forge lang:remove fr

WARNING

Removing a language does not delete existing translation data from the database. Run forge translations:sync --no-prune after removal if you want to preserve orphaned translation rows, or omit the flag to let the sync clean them up.


forge lang:list

Display all configured languages and their settings.

Usage

bash
forge lang:list

Example Output

┌──────┬──────────┬───────────┬───────────┬─────────┐
│ Code │ Name     │ Native    │ Direction │ Default │
├──────┼──────────┼───────────┼───────────┼─────────┤
│ en   │ English  │ English   │ ltr       │ Yes     │
│ ar   │ Arabic   │ العربية   │ rtl       │ No      │
│ fr   │ French   │ Français  │ ltr       │ No      │
└──────┴──────────┴───────────┴───────────┴─────────┘

forge lang:default

Change the default language for the project.

Usage

bash
forge lang:default <CODE>

Example

bash
forge lang:default ar

This updates forge.yaml, regenerates the language seeder, and adjusts the default locale configuration in both the API and frontend apps.


forge lang:supported

Display all languages that FORGE can recognize automatically (code, name, native name, and direction). Useful for discovering valid language codes before adding them to your project.

Usage

bash
forge lang:supported

Example Output

┌──────┬──────────────┬──────────────┬───────────┐
│ Code │ Name         │ Native       │ Direction │
├──────┼──────────────┼──────────────┼───────────┤
│ ar   │ Arabic       │ العربية      │ rtl       │
│ de   │ German       │ Deutsch      │ ltr       │
│ en   │ English      │ English      │ ltr       │
│ es   │ Spanish      │ Español      │ ltr       │
│ fr   │ French       │ Français     │ ltr       │
│ ...  │ ...          │ ...          │ ...       │
└──────┴──────────────┴──────────────┴───────────┘

Total: 25 languages supported

TIP

When you add a language using a supported code, FORGE auto-fills the name, native name, and direction. You only need to specify these manually for custom or unsupported locales.


Translation Commands

Translation commands manage the key-value translation strings used by the API response layer and the Next.js frontend.

forge translations:sync

Synchronize translation files across all configured languages. New keys are added with empty values; optionally, keys that no longer exist in the source are pruned.

bash
forge translations:sync [OPTIONS]
OptionTypeDefaultDescription
--no-pruneflagfalseKeep translation keys that are no longer present in the source language.

Example

bash
forge translations:sync
Syncing translations...
  en: 142 keys (source)
  ar: 138 keys → 142 keys (+4 added)
  fr: 135 keys → 142 keys (+7 added)

Sync complete.

forge translations:export

Export translations to a file for external translators or translation management systems.

bash
forge translations:export [OPTIONS]
OptionTypeDefaultDescription
--outputstringtranslations/Output directory or file path.

Example

bash
forge translations:export --output=./exports/

Generates JSON files per language:

exports/
  en.json
  ar.json
  fr.json

forge translations:import

Import translations from external files back into the project.

bash
forge translations:import [OPTIONS]
OptionTypeDefaultDescription
--inputstringPath to the directory or file containing translations.
--forceflagfalseOverwrite existing translation values. Without this flag, only empty values are populated.

Example

bash
forge translations:import --input=./exports/ --force

WARNING

Using --force overwrites all existing translations for the imported languages. Make sure you have a backup or version control before running this.


Workflow Example

A complete workflow for adding a new language to an existing project:

bash
# 1. Add the language
forge lang:add de --name=German --native=Deutsch

# 2. Sync translation keys (stubs with empty values are created)
forge translations:sync

# 3. Export for your translation team
forge translations:export --output=./to-translate/

# 4. After translators return the files, import them
forge translations:import --input=./translated/ --force

# 5. Update the database
forge seed --class translations

See Also

Released under the MIT License.