Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get semantic domain tree to switch languages #2043

Merged
merged 8 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/components/TreeView/TreeViewActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,19 @@ export function resetTreeAction(): TreeViewAction {
export function traverseTree(domain: SemanticDomain) {
return async (dispatch: StoreStateDispatch) => {
if (domain) {
getSemanticDomainTreeNode(domain.id, domain.lang).then((response) => {
if (response) {
dispatch(setDomainAction(response));
await getSemanticDomainTreeNode(domain.id, domain.lang).then(
(response) => {
if (response) {
dispatch(setDomainAction(response));
}
}
});
);
}
};
}

export function updateTreeLanguage(language: string) {
return async (dispatch: StoreStateDispatch) => {
return (dispatch: StoreStateDispatch) => {
if (language) {
dispatch(setDomainLanguageAction(language));
}
Expand All @@ -54,11 +56,7 @@ export function updateTreeLanguage(language: string) {
export function initTreeDomain(language: string) {
return async (dispatch: StoreStateDispatch, getState: () => StoreState) => {
const currentDomain = getState().treeViewState.currentDomain;
if (currentDomain === defaultState.currentDomain) {
if (!currentDomain.lang) {
currentDomain.lang = language ?? Bcp47Code.Default;
}
await dispatch(traverseTree(currentDomain));
}
currentDomain.lang = language;
await dispatch(traverseTree(currentDomain));
};
}
54 changes: 0 additions & 54 deletions src/resources/semantic.json

This file was deleted.

4 changes: 2 additions & 2 deletions src/types/writingSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ const writingSystem = {

export const defaultWritingSystem = writingSystem[Bcp47Code.Default];

// This list should cover the languages of resources/translations.json
// This list should cover the languages in public/locales/
export const uiWritingSystems = [
writingSystem[Bcp47Code.En],
writingSystem[Bcp47Code.Es],
writingSystem[Bcp47Code.Fr],
];

// This list should cover the domain data in resources/semantic-domains/
// This list should cover the languages in deploy/scripts/semantic_domains/xml/
export const semDomWritingSystems = [
writingSystem[Bcp47Code.En],
writingSystem[Bcp47Code.Es],
Expand Down