Our app has a global reach and our company is undergoing a rebranding process in certain markets.
For instance, we are currently known as "Acme Company" in the U.S. and Canada, but now we aim to be recognized as "Acme Company" in the U.S. and "Foo Company" in Canada.
As of now, our vue-i18n translation files are filled with instances of "Acme Company" within the translations. For example:
TITLE_WELCOME_MSG: 'Acme Company lorem ipsum dolor sit amet, consectetur adipiscing elit.'
The intention is to achieve something like this:
TITLE_WELCOME_MSG: '{companyBrand} lorem ipsum dolor sit amet, consectetur adipiscing elit.'
This entails updating the implementation of TITLE_WELCOME_MSG
to pass companyBrand
like so:
this.$t('TITLE_WELCOME_MSG', { companyBrand: getCompanyBrandBasedOnDomain() })
However, this would require making changes in numerous locations (apparently we mention our name quite a bit). It would be more efficient if I could simply provide companyBrand
to the i18n instance during build time so that all translations automatically incorporate that variable without the need for updates in multiple places.
We want consistency across all locales, meaning viewers in Canada will consistently see "Foo Company." Additionally, ideally, I'd like to eliminate any references to "Acme Company" from the source code entirely.
Is there a method to set up variables within the vue-i18n instance so that they are uniformly translated without requiring adjustments in every implementation?