npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-automated-i18n

v1.3.1

Published

Automates i18n processes; importing, exporting translations and adding new locales or fields etc.

Downloads

203

Readme

vue-automated-i18n

📚 Introduction

This repository automates Vue SFC locales in the i18n custom block, which processes importing locales from JSON, exporting locales to JSON, adding new fields, or adding new locale options.

⚒️ Used Technologies

  • @vue/compiler-sfc
  • Yargs
  • Prettier

Getting Started

For using the project follow the steps below

Installation

You can clone the project with the following URL.

git clone https://github.com/trombonist76/vue-automated-i18n.git
yarn

Script Usages

A. Adding New Locale

Script: yarn add-locale

Example: yarn add-locale --localeKey az --extendKey tr

Shorthand yarn add-locale -l az -e tr

npx npx -p vue-automated-i18n add-locale add-locale -l az -e tr -d src/components

| Builder Opts. | Alias | Default | Required | Example | Description | | -------------- | -------- | ----------------- | --------- | -------------- | ------------------------------------------------------------------------------------ | | localeKey | -l | none | true | tr | New locale option to be added to the component. | | extendKey | -e | none | false | en | The locale whose translations will be transferred to new locale. | | dir | -d | src/components | false | - | The components directory or path that will be added to new locale. |

Add Locale

B. Adding New Field to Component

NOTE: You can add nested fields with using (.) dot. Ex: this.is.nested { this: { is: { nested: givenValue }}}

Script: yarn add-field

Example: `yarn add-field --component Button --fieldName submit --fieldValue OK -d src/components``

Nested - Example: yarn add-field --component Header --fieldName title.header --fieldValue "Header Title"

Shorthand yarn add-field -c Button -f submit -v OK

npx npx -p vue-automated-i18n add-field add-field -f submit -v OK -d src/components

| Builder Opts. | Alias | Default | Required | Example | Description | | -------------- | -------- | ----------------- | --------- | -------------- | ------------------------------------------------------------------------------------ | | component | -c | none | true | Button | The component name, without the '.vue', to which a new field will be added. | | fieldName | -f | none | true | newField | The field name to be added to component as a object key. | | fieldValue | -v | none | true | hi, im value | The field value of the new field to be added to component as a object value. | | dir | -d | src/components | false | src/components/Modal | The component directory that will be added to new field. |

Add Field

C. Adding New Field to All Components

NOTE: You can add nested fields with using (.) dot. Ex: this.is.nested { this: { is: { nested: givenValue }}}

Script: yarn add-field-all

Example: yarn add-field-all --fieldName submit --fieldValue OK --dir src/components

Nested - Example: yarn add-field-all --fieldName title.header --fieldValue "Header Title" --dir src/components

Shorthand yarn add-field-all -f submit -v OK -d src/components

npx npx -p vue-automated-i18n add-field-all add-field-all -f submit -v OK -d src/components

| Builder Opts. | Alias | Default | Required | Example | Description | | -------------- | -------- | ----------------- | --------- | -------------- | ------------------------------------------------------------------------------------ | | fieldName | -f | none | true | newField | The field name to be added to component as a object key. | | fieldValue | -v | none | true | hi, im value | The field value of the new field to be added to component as a object value. | | dir | -d | src/components | false | src/views | The components directory or path that will be added to new field. |

Add Field All

D. Importing locales from JSON

NOTE: The JSON file must be like this:

{
	"src/components/Button": {
		"en": {
			"submit": "OK"
		},
		"tr": {
			"submit": "tamam"
		},
	},
	"src/components/Header": {
		"en": {
			"title": "Header Title"
		},
		"tr": {
			"title": "Header Başlığı"
		},
	}
	// and other files
}

Script: yarn import-locales

Example: yarn import-locales --importFilePath src/imports/locales.json --dir src/components

Shorthand yarn import-locales -p src/imports/locales.json -d src/components

npx npx -p vue-automated-i18n import-locales import-locales -p src/imports/locales.json -d src/components

| Builder Opts. | Alias | Default | Required | Example | Description | | -------------- | -------- | ----------------- | --------- | ------------------------- | ------------------------------------------------------------------------------------ | | importFilePath | -p | none | true | import/locales.json | The path of JSON file to be imported its translations to components. | | dir | -d | src/components | false | src/views | The components directory or path that will be added to locales from JSON. |

Import Locales

E. Exporting locales from JSON

Script: yarn export-locales

Example: yarn export-locales --exportFilePath src/exports/locales.json --dir src/components

Shorthand yarn export-locales -p src/exports/locales.json -d src/components

npx npx -p vue-automated-i18n export-locales export-locales -p src/exports/locales.json -d src/components

| Builder Opts. | Alias | Default | Required | Example | Description | | -------------- | -------- | ----------------- | --------- | ---------------------- | ------------------------------------------------------------------------------------ | | exportFilePath | -p | translations.json | false | export/locales.json | The path of JSON file to be exported components translations. | | dir | -d | src/components | false | src/views | The components directory or path that will be added to locales from JSON. | | component | -c | none | false | Header | The specific component name, without the '.vue', to which its translations will be exported. | | nested | -n | true | false | boolean ex: false | Search components in nested folder structure. |

Export Locales