-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[i18n] .i18nrc file as the source of truth and enhance tooling (#39774)
* scan node_modules/@kbn directory for i18n * remove es-lint-disable-next line * update paths * look inside .i18nrc.json instead of traversing files * split .i18nrc file and enhance i18n tooling * checkout master kibana config * include x-pack/.i18nrc.json file * remove unused import * fix i18n_integrate * fix i18n_integrate * code review changes * code review changes * try using scanDir * revert to using concat * add config type * code review fixes * finalize PR * revert kibana.yml
- Loading branch information
Showing
20 changed files
with
313 additions
and
141 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
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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { resolve, join } from 'path'; | ||
import { I18N_RC } from '../constants'; | ||
import { ErrorReporter, checkConfigNamespacePrefix, arrayify } from '..'; | ||
|
||
export function checkConfigs(additionalConfigPaths: string | string[] = []) { | ||
const root = join(__dirname, '../../../../'); | ||
const kibanaRC = resolve(root, I18N_RC); | ||
const xpackRC = resolve(root, 'x-pack', I18N_RC); | ||
|
||
const configPaths = [kibanaRC, xpackRC, ...arrayify(additionalConfigPaths)]; | ||
|
||
return configPaths.map(configPath => ({ | ||
task: async (context: { reporter: ErrorReporter }) => { | ||
try { | ||
await checkConfigNamespacePrefix(configPath); | ||
} catch (err) { | ||
const { reporter } = context; | ||
const reporterWithContext = reporter.withContext({ name: configPath }); | ||
reporterWithContext.report(err); | ||
throw reporter; | ||
} | ||
}, | ||
title: `Checking configs in ${configPath}`, | ||
})); | ||
} |
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
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,43 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { resolve, join } from 'path'; | ||
import { ErrorReporter, I18nConfig, assignConfigFromPath, arrayify } from '..'; | ||
|
||
export function mergeConfigs(additionalConfigPaths: string | string[] = []) { | ||
const root = join(__dirname, '../../../../'); | ||
const kibanaRC = resolve(root, '.i18nrc.json'); | ||
const xpackRC = resolve(root, 'x-pack/.i18nrc.json'); | ||
|
||
const configPaths = [kibanaRC, xpackRC, ...arrayify(additionalConfigPaths)]; | ||
|
||
return configPaths.map(configPath => ({ | ||
task: async (context: { reporter: ErrorReporter; config?: I18nConfig }) => { | ||
try { | ||
context.config = await assignConfigFromPath(context.config, configPath); | ||
} catch (err) { | ||
const { reporter } = context; | ||
const reporterWithContext = reporter.withContext({ name: configPath }); | ||
reporterWithContext.report(err); | ||
throw reporter; | ||
} | ||
}, | ||
title: `Merging configs in ${configPath}`, | ||
})); | ||
} |
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
Oops, something went wrong.