Skip to content

languagepack

Manage language packs for internationalization (i18n) in your projects.

Synopsis

bash
pfy languagepack <subcommand> [flags]

Aliases: l, lang, lp

Description

Language packs provide internationalization support for your applications. Each language pack contains translations for a specific language/locale combination.

Subcommands

  • list - List all language packs in a project
  • init - Initialize a new language pack in the project
  • remove - Remove a language pack

Naming

The subcommand that creates a language pack is init, not create. There is no languagepack create and no languagepack get.

languagepack list

List all language packs available in a project.

Usage

bash
pfy languagepack list --project-id <project-id> [flags]

Flags

FlagRequiredDescription
--project-idYesProject ID
--limitNoMaximum number of items to return — if unset, every item is fetched
--offsetNoNumber of items to skip before returning results — defaults to the first item

Example

bash
pfy languagepack list --project-id 01234567-89ab-cdef-0123-456789abcdef

Output:

Language Packs:
  - English (en)
  - Spanish (es)
  - German (de)
  - French (fr)

Verbose output:

bash
pfy --verbose languagepack list --project-id 01234567-89ab-cdef-0123-456789abcdef
Connecting to ProductifyFW manager...
Fetching language packs for project ID '01234567-89ab-cdef-0123-456789abcdef'...
Found 4 language pack(s)
Language Packs:
  - English (en)
    ID: dddddddd-eeee-ffff-0000-111111111111
  - Spanish (es)
    ID: eeeeeeee-ffff-0000-1111-222222222222
  - German (de)
    ID: ffffffff-0000-1111-2222-333333333333
  - French (fr)
    ID: 00000000-1111-2222-3333-444444444444

languagepack init

Initialize (create) a new language pack in the project.

Usage

bash
pfy languagepack init \
  --project-id <project-id> \
  --identifier <identifier> \
  --name <name>

Flags

FlagAliasesRequiredDescription
--project-idYesProject ID
--identifier--idYesLanguage identifier (e.g., en, es-MX, de-DE)
--nameYesHuman-readable language pack name

How the flags map onto the API

The two flags do not map onto the same-named GraphQL fields, because the manager's LanguagePack.name is the locale code:

  • --identifier (the locale code, e.g. en-US) is sent as the schema's name.
  • --name (the human-readable label, e.g. English (US)) is sent as the schema's displayName.

There is no identifier field in the schema. See GraphQL Operations.

Examples

Basic language pack:

bash
pfy languagepack init \
  --project-id 01234567-89ab-cdef-0123-456789abcdef \
  --identifier en \
  --name "English"

Regional variant:

bash
pfy languagepack init \
  --project-id 01234567-89ab-cdef-0123-456789abcdef \
  --identifier es-MX \
  --name "Spanish (Mexico)"

Using short aliases:

bash
pfy lp init --project-id 01234567-89ab-cdef-0123-456789abcdef --id fr --name "French"

Output:

Language pack created successfully: French (fr)

languagepack remove

Remove an existing language pack from the project.

Usage

bash
pfy languagepack remove --languagepack-id <id>

Flags

FlagAliasesRequiredDescription
--languagepack-id--idYesID of the language pack to remove

Example

bash
pfy languagepack remove --languagepack-id eeeeeeee-ffff-0000-1111-222222222222

Output:

Language pack removed successfully

Common Language Identifiers

IdentifierLanguage
enEnglish
en-USEnglish (United States)
en-GBEnglish (United Kingdom)
esSpanish
es-MXSpanish (Mexico)
es-ESSpanish (Spain)
frFrench
fr-CAFrench (Canada)
deGerman
de-ATGerman (Austria)
itItalian
ptPortuguese
pt-BRPortuguese (Brazil)
zhChinese
zh-CNChinese (Simplified)
zh-TWChinese (Traditional)
jaJapanese
koKorean
arArabic
ruRussian
plPolish
nlDutch
svSwedish
daDanish
fiFinnish
noNorwegian
trTurkish
heHebrew
hiHindi

Workflow Example

Setting Up Multi-language Support

bash
# Get project ID
PROJECT_ID=$(pfy project get --slug my-saas | grep "ID:" | awk '{print $2}')

# Create base language (English)
pfy languagepack init --project-id $PROJECT_ID --id en --name "English"

# Add additional languages
pfy languagepack init --project-id $PROJECT_ID --id es --name "Spanish"
pfy languagepack init --project-id $PROJECT_ID --id de --name "German"
pfy languagepack init --project-id $PROJECT_ID --id fr --name "French"

# List all language packs
pfy languagepack list --project-id $PROJECT_ID

GraphQL Operations

GetLanguagePacks

graphql
query GetLanguagePacks(
  $project: ID!
  $filters: [FilterInput!]
  $order: [OrderInput!]
  $pagination: PaginationInput
) {
  languagePacks(
    project: $project
    filters: $filters
    order: $order
    pagination: $pagination
  ) {
    id
    name
    displayName
  }
}

CreateLanguagePack

projectId is a required top-level argument, not a field of the input — the resolver overrides any project carried in the input with it.

graphql
mutation CreateLanguagePack($projectId: ID!, $input: CreateLanguagePackInput!) {
  createLanguagePack(projectId: $projectId, input: $input) {
    id
    name
    displayName
  }
}

Input Type:

graphql
input CreateLanguagePackInput {
  "Language pack identifier (e.g., 'en-US', 'hu-HU') — the CLI's --identifier"
  name: String!
  "Human-readable display name (e.g., 'English (US)') — the CLI's --name"
  displayName: String
}

DeleteLanguagePack

graphql
mutation DeleteLanguagePack($id: ID!) {
  deleteLanguagePack(id: $id)
}

See Also