https://github.com/videojs/videojs-languages
https://github.com/videojs/videojs-languages
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/videojs/videojs-languages
- Owner: videojs
- License: other
- Created: 2015-11-19T21:55:24.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-04-12T17:24:29.000Z (over 3 years ago)
- Last Synced: 2025-07-08T02:13:55.259Z (6 months ago)
- Language: JavaScript
- Size: 122 KB
- Stars: 4
- Watchers: 16
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [videojs-languages](#videojs-languages)
- [Installation](#installation)
- [CLI Usage](#cli-usage)
- [Specifying a Destination Directory](#specifying-a-destination-directory)
- [Create as an ES module](#create-as-an-es-module)
- [Options](#options)
- [API Usage](#api-usage)
- [License](#license)
# videojs-languages
[](https://travis-ci.org/videojs/videojs-languages)
[](https://greenkeeper.io/)
[](http://slack.videojs.com)
[](https://nodei.co/npm/videojs-languages/)
A CLI program for converting [video.js JSON language files](https://github.com/videojs/video.js/blob/master/docs/guides/languages.md#creating-the-language-file) into [executable video.js language definitions](https://github.com/videojs/video.js/blob/master/docs/guides/languages.md#adding-languages-to-videojs).
## Installation
```sh
$ npm install -g videojs-languages
```
This will install the `vjslang` binary on your `$PATH`.
## CLI Usage
The `vjslang` binary takes any number of [glob-like arguments](https://www.npmjs.com/package/minimatch) for targeting `.json` files:
```sh
$ vjslang **/*.json foo/bar/*.json
```
If no glob arguments are given, for example:
```sh
$ vjslang
```
The program will fall back to `lang/*.json`.
### Specifying a Destination Directory
By default, each converted `.js` file will be output alongside its source `.json` file, but a `--dir`/`-d` option can be used to specify a directory where _all_ `.js` file(s) will end up:
```sh
$ vjslang foo/bar.json --dir baz
```
The directory will be created if it does not exist. If creation fails, `vjslang` will fall back to its default behavior.
### Create as an ES module
The `--asModule`/`-m` option creates an .mjs moduel file which can be directly imported.
```sh
$ vjslang foo/bar.json --dir baz --asModule
```
### Options
The `--dir`/`-d` and `--asModule`/`-m` options are the most interesting/useful. For full option documentation refer to:
```sh
$ vjslang --help
```
## API Usage
There is a very simple programmatic API that can be used in your own programs. It is used like this:
```js
import convert from 'videojs-languages';
const asModule = true;
convert(['foo/bar.json', 'baz/*.json'], 'langs', asModule);
```
## License
Apache-2.0