Skip to content

languagepack ​

pfy languagepack lists, creates, reads, and removes a project's language packs. A language pack is one locale (such as en or es-MX) with a display name; applications use them for translations. All subcommands take the project ID, not the slug.

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
  • create - Create a new language pack in the project
  • get - Get a single language pack by ID
  • remove - Remove a language pack

languagepack init is a hidden, deprecated alias of create; use create.

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)
4 language packs

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
4 language packs

languagepack create ​

Create a new language pack in the project. (languagepack init is a hidden, deprecated alias of this command.)

Usage ​

bash
pfy languagepack create \
  --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 create \
  --project-id 01234567-89ab-cdef-0123-456789abcdef \
  --identifier en \
  --name "English"

Regional variant:

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

Using short aliases:

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

Output:

Language pack created successfully: French (fr)

languagepack get ​

Get a single language pack by ID.

Usage ​

bash
pfy languagepack get <id> --project-id <project-id>

Flags ​

FlagAliasesRequiredDescription
--project-idYesProject ID
--id--languagepack-idNoLanguage pack ID (or pass it positionally)

Example ​

bash
pfy languagepack get dddddddd-eeee-ffff-0000-111111111111 \
  --project-id 01234567-89ab-cdef-0123-456789abcdef
Language Pack: English (en)
ID: dddddddd-eeee-ffff-0000-111111111111

languagepack remove ​

Remove an existing language pack from the project.

Usage ​

bash
pfy languagepack remove --languagepack-id <id> [--yes]

Flags ​

FlagAliasesRequiredDescription
--languagepack-id--idYesID of the language pack to remove
--yes-yNoSkip the confirmation prompt. Required under --ci or when stdin is not a terminal

On a terminal you must type the ID back to confirm.

Example ​

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

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 create --project-id $PROJECT_ID --id en --name "English"

# Add additional languages
pfy languagepack create --project-id $PROJECT_ID --id es --name "Spanish"
pfy languagepack create --project-id $PROJECT_ID --id de --name "German"
pfy languagepack create --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 ​