Currently, we have two sources of truth for the source and the target languages: we store the values of the current source/target language both inside URL parameters and inside Vuex application state.
Storing the languages inside URL parameters is essential to provide support for several features that are based on prepared URLs. On the other hand, storing the languages inside the Vuex store, was our initial approach and is still in use in several places, but it's redundant and can be deprecated in favor of the URL params, so that we only have one single source of truth for these language values.
The following files should be updated to use the source/target language values from the URL, instead of the application state:
- useTranslationSave.js
- CXSuggestionList.vue
- useLanguageHelper.js
- CXTranslationWorkPublished.vue
- useDashboardInitialization.js
-
useDraftTranslationDelete.js - useDraftTranslationStart.js
- SXArticleLanguageSelector.vue
- SXArticleSearch.vue
- SearchResultsCard.vue
-
usePageTranslationStart.js - SXContentComparator.vue
- EditCompleteFeedback.vue
- SXEditor.vue
- useMtValidate.js
- usePublishingComplete.js
- SXSectionSelector.vue
- ProposedTranslationCard.vue
- SXSentenceSelector.vue
- SXSentenceSelectorContentHeader.vue
- SXTranslationSelector.vue
- TranslatedSegmentCard.vue
- useMtProvidersInitialize.js
- useSuggestionsInitialize.js
- useConfirmationButtonClickHandlers.js
- useSuggestionSeeds.js
- useSuggestionValidator.js
- useSuggestionsFetch.js
- useSuggestionFetchByMostPopular.js
- useSuggestionsFetchByEdits.js
- useSuggestionsFetchByTopics.js
- useSuggestions.js
- useTranslationPublish.js
- useEditedTranslationApply.js
The following files use the sourceLanguageAutonym and targetLanguageAutonym computed variables from useApplicationState composable, which depend on sourceLanguage and targetLanguage application state variables:
- useListSelector.js
- CXTranslationSuggestion.vue
- SearchResultsCard.vue
- SXTranslationConfirmerActionPanel.vue
- BlockTemplateAdaptationCard.vue
- SXBlockTemplateStatusDialog.vue
- SXSectionSelector.vue
- useApplicationState.js
Once we remove the above usages, we can safely remove the sourceLanguage and targetLanguagevariables from the application state, entirely.
What to do
For each one of these files, we are going to be replacing the sourceLanguage and targetLanguage from Vuex application state with the new approach which takes the values from the URL.
Example patch: patch.
For the files with sourceLanguageAutonym and targetLanguageAutonym.
Example patch: patch.