dannyconnell / quasalang

Generate Quasar i18n language files from a CSV file
38 stars 14 forks source link

Updated Generator & Added Search add Add selected lang code to CSV column #11

Open dipaksarkar opened 7 months ago

dipaksarkar commented 7 months ago

Sanitize Language Codes:

Modified the generation of import statements in the main index file to sanitize language codes by removing hyphens and converting them to camelCase.

"Key","English, en-US","French, fr","Hindi (India), hi_IN","Romanian (Romania), ro_RO"
"label.active","Active","Actif","सक्रिय","Activ"
"label.addAnnouncement","Add announcement","Ajouter une annonce","घोषणा जोड़ें","Adauga anunt"

// will be converted following

{
    label: {
        add: 'Active',
        addAnnouncement: 'Add announcement',
    }
}

Search and Add i18n Locale Codes

quasalang list-codes --add

? Enter a search query (e.g. "russian") or hit Enter to list all codes: italian

? Select languages to add: Russian, ru, Russian (Moldova), ru_MD

CSV file successfully written with new lang codes: Russian, ru, Russian (Moldova), ru_MD.
dipaksarkar commented 3 months ago

Added Following commands

parse

Usage: quasalang parse|p [options]

Parse your source files from (/src/**/*.{js,vue}) and Add them to (/translations.csv) as Default language

Options:
  -h, --help  display help for command

Example

Given the following label in your source files:

<base-label>{{ $t("// Phone Number") }}</base-label>
or
<base-label>{{ $t("// label::Phone Number") }}</base-label>

The command will convert them to:

<base-label>{{ $t("phoneNumber") }}</base-label>
or
<base-label>{{ $t("label.phoneNumber") }}</base-label>

The corresponding translation key will be added to translations.csv:

phoneNumber,"Phone Number"
or
label.phoneNumber,"Phone Number"

translate

Usage: quasalang translate|t [options]

Translate your CSV file using Google translate

Options:
  -h, --help  display help for command

check-trans

Usage: quasalang check-trans|ct [options]

Find missing trans key in (/translations.csv) from (/src/**/*.{js,vue})

Options:
  -h, --help  display help for command

trans-clean

Usage: quasalang trans-clean|tc [options]

Remove unused trans key from (/translations.csv)

Options:
  -h, --help  display help for command