Skip to content

Commit

Permalink
Merge branch 'release/9.6' into fix/store-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhirocks889 committed Feb 25, 2024
2 parents c54cdb8 + f4fa63b commit 985abb2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export interface ParserOutput {
* Component extractor parser.
*/
export class ComponentParser {
private globalConfigCategoriesMap: Map<string, string>;

/**
* @param libraryName
Expand All @@ -79,7 +80,9 @@ export class ComponentParser {
private strictMode: boolean = false,
private libraries: string[] = [],
private globalConfigCategories: CategoryDescription[] = []
) {}
) {
this.globalConfigCategoriesMap = new Map(this.globalConfigCategories.map((category) => [category.name, category.label]));
}

/** Get the list of patterns from tsconfig.json */
private getPatternsFromTsConfig() {
Expand Down Expand Up @@ -125,22 +128,23 @@ export class ComponentParser {
const configurationFileExtractor = new ComponentConfigExtractor(this.libraryName, this.strictMode, source, this.logger, file, checker, this.libraries);
const configuration = configurationFileExtractor.extract();
if (configuration.configurationInformation) {
const globalConfigCategoriesMap = new Map(this.globalConfigCategories.map((category) => [category.name, category.label]));
(configuration.configurationInformation.categories || []).forEach((category) => {
if (globalConfigCategoriesMap.has(category.name)) {
if (this.globalConfigCategoriesMap.has(category.name)) {
this.logger.warn(`The category ${category.name} is already defined in the global ones.`);
}
});
const categoriesMap = new Map((configuration.configurationInformation.categories || []).map((category) => [category.name, category.label]));
configuration.configurationInformation.properties.forEach((prop) => {
if (prop.category) {
if (!categoriesMap.has(prop.category) && globalConfigCategoriesMap.has(prop.category)) {
categoriesMap.set(prop.category, globalConfigCategoriesMap.get(prop.category)!);
} else {
this.logger.warn(
`The property ${prop.name} from ${configuration.configurationInformation!.name} has an unknown category ${prop.category}. The category will not be set for this property.`
);
delete prop.category;
if (!categoriesMap.has(prop.category)) {
if (this.globalConfigCategoriesMap.has(prop.category)) {
categoriesMap.set(prop.category, this.globalConfigCategoriesMap.get(prop.category)!);
} else {
this.logger.warn(
`The property ${prop.name} from ${configuration.configurationInformation!.name} has an unknown category ${prop.category}. The category will not be set for this property.`
);
delete prop.category;
}
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ export class LocalizationDevtoolsConsoleService implements DevtoolsServiceInterf
* @inheritdoc
*/
public updateLocalizationKeys(keyValues: { [key: string]: string }, language?: string): void | Promise<void> {
Object.entries(keyValues).map(([key, value]) => {
this.localizationService.getTranslateService().set(key, value, language || this.localizationDevtools.getCurrentLanguage());
});
this.localizationService.getTranslateService().setTranslation(
language || this.localizationDevtools.getCurrentLanguage(),
keyValues,
true
);
this.appRef.tick();
}

Expand Down

0 comments on commit 985abb2

Please sign in to comment.