-
Notifications
You must be signed in to change notification settings - Fork 934
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also: * Force validation of i18n even when no translations are available * Allow including translations in built artifacts Signed-off-by: Miki <[email protected]>
- Loading branch information
Showing
22 changed files
with
237 additions
and
111 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
{ | ||
"paths": { | ||
"embeddableExamples": "embeddable_examples", | ||
"expressionsExample": "expressions_example", | ||
"multipleDataSourceExample": "multiple_data_source_examples", | ||
"searchExamples": "search_examples", | ||
"stateContainerExamples": "state_containers_examples", | ||
"uiActionsExamples": "ui_action_examples", | ||
"uiActionsExplorer": "ui_actions_explorer" | ||
}, | ||
"translations": [] | ||
} |
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,6 @@ | ||
{ | ||
"paths": { | ||
"flot": "osd-ui-shared-deps/flot_charts" | ||
}, | ||
"translations": [] | ||
} |
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,85 @@ | ||
{ | ||
"paths": { | ||
"advancedSettings": "plugins/advanced_settings", | ||
"apmOss": "plugins/apm_oss", | ||
"charts": "plugins/charts", | ||
"common.ui": "legacy/ui", | ||
"console": "plugins/console", | ||
"contentManagement": "plugins/content_management", | ||
"core": "core", | ||
"dashboard": "plugins/dashboard", | ||
"data": "plugins/data", | ||
"dataExplorer": "plugins/data_explorer", | ||
"dataSourcesManagement": "plugins/data_source_management", | ||
"devTools": "plugins/dev_tools", | ||
"discover": "plugins/discover", | ||
"embeddableApi": "plugins/embeddable", | ||
"expressions": "plugins/expressions", | ||
"home": "plugins/home", | ||
"indexPatternManagement": "plugins/index_pattern_management", | ||
"inputControl": "plugins/input_control_vis", | ||
"inspector": "plugins/inspector", | ||
"inspectorViews": "legacy/core_plugins/inspector_views", | ||
"interpreter": "legacy/core_plugins/interpreter", | ||
"management": [ | ||
"legacy/core_plugins/management", | ||
"plugins/management", | ||
"plugins/management_overview" | ||
], | ||
"maps_legacy": "plugins/maps_legacy", | ||
"navigation": "plugins/navigation", | ||
"newsfeed": "plugins/newsfeed", | ||
"opensearch_dashboards_legacy": "plugins/opensearch_dashboards_legacy", | ||
"opensearchDashboardsOverview": "plugins/opensearch_dashboards_overview", | ||
"opensearch-dashboards-react": "plugins/opensearch_dashboards_react", | ||
"opensearch_dashboards_react": "legacy/core_plugins/opensearch_dashboards_react", | ||
"opensearch_dashboards_utils": "plugins/opensearch_dashboards_utils", | ||
"opensearchUi": "plugins/opensearch_ui_shared", | ||
"osd": "legacy/core_plugins/opensearch-dashboards", | ||
"osdDocViews": "legacy/core_plugins/osd_doc_views", | ||
"osdDocViewsLinks": "legacy/core_plugins/osd_doc_views_links", | ||
"queryEnhancements": "plugins/query_enhancements", | ||
"regionMap": "plugins/region_map", | ||
"savedObjects": "plugins/saved_objects", | ||
"savedObjectsManagement": "plugins/saved_objects_management", | ||
"security": "plugins/security_oss", | ||
"server": "legacy/server", | ||
"share": "plugins/share", | ||
"statusPage": "legacy/core_plugins/status_page", | ||
"telemetry": [ | ||
"plugins/telemetry", | ||
"plugins/telemetry_management_section" | ||
], | ||
"tileMap": "plugins/tile_map", | ||
"timeline": [ | ||
"plugins/vis_type_timeline" | ||
], | ||
"uiActions": "plugins/ui_actions", | ||
"usageCollection": "plugins/usage_collection", | ||
"visAugmenter": "plugins/vis_augmenter", | ||
"visBuilder": "plugins/vis_builder", | ||
"visDefaultEditor": "plugins/vis_default_editor", | ||
"visTypeMarkdown": "plugins/vis_type_markdown", | ||
"visTypeMetric": "plugins/vis_type_metric", | ||
"visTypeTable": "plugins/vis_type_table", | ||
"visTypeTagCloud": "plugins/vis_type_tagcloud", | ||
"visTypeTimeseries": "plugins/vis_type_timeseries", | ||
"visTypeVega": "plugins/vis_type_vega", | ||
"visTypeVislib": "plugins/vis_type_vislib", | ||
"visTypeXy": "plugins/vis_type_xy", | ||
"visualizations": "plugins/visualizations", | ||
"visualize": "plugins/visualize", | ||
"workspace": "plugins/workspace" | ||
}, | ||
"exclude": [ | ||
"legacy/ui/ui_render/ui_render_mixin.js", | ||
"plugins/home/public/application/components/tutorial", | ||
"plugins/home/server/tutorials", | ||
"core/server/rendering/views/template.tsx", | ||
"plugins/data/public/search/errors/timeout_error.tsx", | ||
"plugins/home/public/application/components/welcome.tsx", | ||
"plugins/vis_type_timeline/server/series_functions/graphite.js", | ||
"plugins/vis_type_timeseries/public/application/components/aggs/serial_diff.js" | ||
], | ||
"translations": [] | ||
} |
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,51 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { i18nLoader } from '@osd/i18n'; | ||
import { write, Task } from '../lib'; | ||
import { getTranslationPaths } from '../../../legacy/server/i18n/get_translations_path'; | ||
import { I18N_RC, DEFAULT_DIRS_WITH_RC_FILES } from '../../i18n/constants'; | ||
|
||
const TRANSLATIONS_PATH = 'i18n'; | ||
|
||
export const CopyTranslations: Task = { | ||
description: 'Copying translations into platform-generic build directory', | ||
|
||
async run(config, log, build) { | ||
const repoRoot = config.resolveFromRepo(); | ||
|
||
log.info('Gathering translations'); | ||
|
||
const allTranslationPaths = await getTranslationPaths({ | ||
cwd: repoRoot, | ||
// `,.` is added for backward compatibility | ||
// ToDo: Remove `,.` for next major release | ||
glob: `{${DEFAULT_DIRS_WITH_RC_FILES.join(',')},.}/${I18N_RC}`, | ||
}); | ||
|
||
i18nLoader.registerTranslationFiles(allTranslationPaths); | ||
|
||
log.info('Combining translations'); | ||
|
||
const translationFiles: string[] = []; | ||
|
||
for (const locale of i18nLoader.getRegisteredLocales()) { | ||
const { formats, messages } = await i18nLoader.getTranslationsByLocale(locale); | ||
const translationFilename = `${locale}.json`; | ||
translationFiles.push(translationFilename); | ||
await write( | ||
build.resolvePath(`${TRANSLATIONS_PATH}/${translationFilename}`), | ||
JSON.stringify({ formats, messages }) | ||
); | ||
} | ||
|
||
log.info('Generating translation manifest'); | ||
|
||
await write( | ||
build.resolvePath(`${TRANSLATIONS_PATH}/${I18N_RC}`), | ||
JSON.stringify({ translations: translationFiles }) | ||
); | ||
}, | ||
}; |
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.