@vocab/types
Advanced tools
Comparing version 0.0.6 to 0.0.7
# @vocab/types | ||
## 0.0.7 | ||
### Patch Changes | ||
- [`283bcad`](https://github.com/seek-oss/vocab/commit/283bcada06e622ab14ed891743ed3f55cf09e245) [#33](https://github.com/seek-oss/vocab/pull/33) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Move all vocab files to single directory with configurable suffix | ||
* [`f3992ef`](https://github.com/seek-oss/vocab/commit/f3992efbf08939ebf853fac650a49cc46dc51dfb) [#34](https://github.com/seek-oss/vocab/pull/34) Thanks [@jahredhope](https://github.com/jahredhope)! - Validate translation files as loaded. Providing additional error messaging. | ||
## 0.0.6 | ||
@@ -4,0 +12,0 @@ |
@@ -16,2 +16,5 @@ import type { IntlMessageFormat } from 'intl-messageformat'; | ||
export interface UserConfig { | ||
/** | ||
* The root directory to compile and validate translations | ||
*/ | ||
projectRoot?: string; | ||
@@ -26,4 +29,7 @@ /** | ||
languages: Array<LanguageTarget>; | ||
translationsDirname?: string; | ||
/** | ||
* A custom suffix to name vocab translation directories | ||
*/ | ||
translationsDirectorySuffix?: string; | ||
/** | ||
* An array of glob paths to ignore from compilation and validation | ||
@@ -30,0 +36,0 @@ */ |
{ | ||
"name": "@vocab/types", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"main": "dist/vocab-types.cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/vocab-types.esm.js", |
@@ -71,5 +71,5 @@ # Vocab | ||
**Note:** Currently, to create a new translation it must be placed inside a **`__translations__`** folder, this folder name can be configured with `translationsDirname` configuration. | ||
**Note:** Currently, to create a new translation it must be placed inside a folder ending in **`.vocab`**, this folder suffix can be configured with the `translationsDirectorySuffix` configuration value. | ||
**`./__translations__/translations.json`** | ||
**`./example.vocab/translations.json`** | ||
@@ -86,3 +86,3 @@ ```json | ||
Then run `vocab compile`. Or `vocab compile --watch`. | ||
This will create new `translation.ts` files for each `translation.json` file. | ||
This will create a new `index.ts` file for each folder ending in **`.vocab`**. | ||
@@ -95,3 +95,3 @@ You can then import these translations into your React components. Translations can be used by calling the `t` function returned by `useTranslation`. | ||
import { useTranslation } from '@vocab/react'; | ||
import translations from './translations'; | ||
import translations from './example.vocab'; | ||
@@ -106,5 +106,5 @@ function MyComponent({ children }) { | ||
So far your app will run, but you're missing any translations other than the initial language. The below file can be created manually; however, you can also integrate with a remote translation platform to push and pull translations automatically. | ||
So far your app will run, but you're missing any translations other than the initial language. The below file can be created manually; however, you can also integrate with a remote translation platform to push and pull translations automatically. See [Externeral translation tooling](#external-translation-tooling) for more information. | ||
**./\_\_translations\_\_/translations.fr-FR.json** | ||
**./example.vocab/fr-FR.translations.json** | ||
@@ -156,3 +156,17 @@ ```json | ||
{ name: 'fr-FR' } | ||
] | ||
], | ||
/** | ||
* The root directory to compile and validate translations | ||
* Default: Current working directory | ||
*/ | ||
projectRoot: ['./example/']; | ||
/** | ||
* A custom suffix to name vocab translation directories | ||
* Default: '.vocab' | ||
*/ | ||
translationsDirectorySuffix: '.vocab', | ||
/** | ||
* An array of glob paths to ignore from compilation and validation | ||
*/ | ||
ignore: ['**/ignored_directory/**'] | ||
}; | ||
@@ -163,5 +177,5 @@ ``` | ||
Vocab generates custom `translation.ts` files that give your React components strongly typed translations to work with. | ||
Vocab generates custom `index.ts` files that give your React components strongly typed translations to work with. | ||
To generate these types run: | ||
To generate these files run: | ||
@@ -172,3 +186,3 @@ ```bash | ||
Or to rerun the compiler when files change use: | ||
Or to re-run the compiler when files change use: | ||
@@ -175,0 +189,0 @@ ```bash |
@@ -31,2 +31,5 @@ import type { IntlMessageFormat } from 'intl-messageformat'; | ||
export interface UserConfig { | ||
/** | ||
* The root directory to compile and validate translations | ||
*/ | ||
projectRoot?: string; | ||
@@ -41,4 +44,7 @@ /** | ||
languages: Array<LanguageTarget>; | ||
translationsDirname?: string; | ||
/** | ||
* A custom suffix to name vocab translation directories | ||
*/ | ||
translationsDirectorySuffix?: string; | ||
/** | ||
* An array of glob paths to ignore from compilation and validation | ||
@@ -45,0 +51,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12497
124
202