VS Code extension to ease the burden of adding localized keys and strings to multiple typed culture files
Documentation
For more detailed documentation on commands and settings, check the docs site hosted on GitHub Pages.
Requirements
import {
BaseEnglishUnitedStates,
Culture,
LocalizationUtils,
} from "andculturecode-javascript-core";
import CultureResources from "utilities/interfaces/culture-resources";
const EnglishUnitedStates: Culture<CultureResources> = LocalizationUtils.cultureFactory(
BaseEnglishUnitedStates,
{
resources: {
accountInformation: "Account Information",
cancelMySubscription: "Cancel My Subscription",
checkOutFaq: "Check out our FAQs",
subscriptionDetails: "Subscription Details",
teamManagement: "Team Management",
},
}
);
See the AndcultureCode wiki page for more information on setting up internationalization in TypeScript.
How it works
This extension leverages ts-morph
under the hood to read & manipulate the TypeScript AST. This means that you don't need the interface or culture files open in your VS Code window for it to perform the manipulations.
It also means that it manipulates the files from their saved versions on disk - if you have open but unsaved changes in your editor, it's going to yell at you when you try to save because the file on disk will be newer than the version in your editor.
For translating non-English copy, the extension leverages @vitalets/google-translate-api
, determining which language to translate to based on the base culture being extended from andculturecode-javascript-core
(currently supporting Spanish, but can be easily updated).