-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0350b83
commit 1d5ba35
Showing
12 changed files
with
1,024 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,6 @@ package-lock.json | |
# Yarn | ||
.yarnclean | ||
yarn-error.log | ||
|
||
# Exclude translation files | ||
src/lib/locales/*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { parseErrors } from './lib/errorParser'; | ||
export { errorConfig as errors } from './lib/errorConfig'; | ||
export { importTranslations, Options } from './lib/importTranslations'; | ||
export * from './lib/errors'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as i18n from 'i18n'; | ||
|
||
i18n.configure({ | ||
directory: __dirname + '/locales', | ||
}); | ||
|
||
export default i18n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const translations = require('icapps-translations'); | ||
|
||
const url = ''; | ||
const defaultOptions = { | ||
destination: './lib/locales', | ||
}; | ||
|
||
export function importTranslations(token: string, options?: Options) { | ||
try { | ||
const allOptions = Object.assign({}, defaultOptions, options); | ||
return translations.import(url, token, allOptions); | ||
} catch (ex) { | ||
throw ex; | ||
} | ||
} | ||
|
||
export interface Options { | ||
destination?: string; | ||
clean?: boolean; | ||
verbose?: boolean; | ||
seperateCategories?: boolean; | ||
exportType?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"INTERNAL_ERROR": "An unkown error occurred", | ||
"INVALID_INPUT": "Invalid input provided", | ||
"AUTHENTICATION_FAILED": "Authentication failed", | ||
"BAD_REQUEST": "Bad request", | ||
"MISSING_HEADERS": "Missing headers", | ||
"UNAUTHORIZED": "Unauthorized", | ||
"FORBIDDEN": "NO access", | ||
"RESOURCE_NOT_FOUND": "Resource not found" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as fs from 'fs'; | ||
import { importTranslations, Options } from '../src'; | ||
|
||
describe('importTranslations', () => { | ||
it('should import the translations', async () => { | ||
await importTranslations('randomToken'); | ||
expect(await fs.existsSync('./src/lib/locales/en.json')).toEqual(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,6 @@ | |
"exclude": [ | ||
"node_modules", | ||
"**/*.test.ts", | ||
"build" | ||
"build", | ||
] | ||
} |
Oops, something went wrong.