Localization
Translation strings
Translations can be accessed via this.$locale in components or pages, or by importing the locale global.
typescript// In components or pagesthis.$locale.general.filters.show_more; // "Show More"this.$locale['general.filters.show_more']; // "Show More"// In other filesimport {locale} from 'salvo-ts';locale.general.filters.show_more; // "Show More"locale['general.filters.show_more']; // "Show More"
typescript// In components or pagesthis.$locale.general.filters.show_more; // "Show More"this.$locale['general.filters.show_more']; // "Show More"// In other filesimport {locale} from 'salvo-ts';locale.general.filters.show_more; // "Show More"locale['general.filters.show_more']; // "Show More"
Translation typings are generated automatically from your theme's static/locales/en.default.liquid - you should make sure (as is best practice) that all of your locale files have an identical format.
Whenever you edit your theme's locale files, run npm run generate:types to re-generated typings.
Money formatting
You can format money strings using an instance of MoneyFormatter, accessible via this.$money in components and pages, or by importing the money global.
// TODO
this.$money and the money global automatically respect
typescript// In components or pagesthis.$money.format(1234);
typescript// In components or pagesthis.$money.format(1234);