Setup eslint and enforce rules
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
import {Template} from "../../cli"
|
||||
import {UniversalPath} from "../../util"
|
||||
import {Container} from "../../di"
|
||||
import {Config} from "../../service/Config";
|
||||
import {Template} from '../../cli'
|
||||
import {Container} from '../../di'
|
||||
import {Config} from '../../service/Config'
|
||||
|
||||
/**
|
||||
* CLI template that generates a new locale file.
|
||||
* Automatically adds placeholder entries for phrases that exist in the
|
||||
* associated common locale file.
|
||||
*/
|
||||
const locale_template: Template = {
|
||||
const templateLocale: Template = {
|
||||
name: 'locale',
|
||||
fileSuffix: '.config.ts',
|
||||
description: 'Create a new config file that specifies translations for a locale.',
|
||||
baseAppPath: ['configs', 'lang'],
|
||||
render: (name: string, fullCanonicalName: string, targetFilePath: UniversalPath) => {
|
||||
render: (name: string, fullCanonicalName: string) => {
|
||||
const config = <Config> Container.getContainer().make(Config)
|
||||
const subloc = fullCanonicalName.split(':').slice(1).join(':')
|
||||
const subloc = fullCanonicalName.split(':').slice(1)
|
||||
.join(':')
|
||||
const common: any = config.get(`lang:common${subloc ? ':' + subloc : ''}`, {})
|
||||
|
||||
return `import {env} from '@extollo/lib'
|
||||
@@ -27,4 +27,4 @@ ${Object.keys(common).map(key => ' ' + key + ': \'\',\n')}
|
||||
},
|
||||
}
|
||||
|
||||
export { locale_template }
|
||||
export { templateLocale }
|
||||
|
||||
Reference in New Issue
Block a user