private static (DirectoryInfo, TranslationService) Setup(TranslateArguments arguments, string fileName) { if (!Directory.Exists(arguments.Folder)) { throw new ArgumentException("Folder does not exist."); } var supportedLocaled = new string[] { "en", "nl", "it" }; var locales = supportedLocaled; if (arguments.Locales != null && arguments.Locales.Any()) { locales = supportedLocaled.Intersect(arguments.Locales).ToArray(); } if (locales.Length == 0) { locales = supportedLocaled; } var translationsDirectory = new DirectoryInfo(Path.Combine(arguments.Folder, "backend", "i18n")); var translationsService = new TranslationService(translationsDirectory, fileName, locales, arguments.SingleWords); return(new DirectoryInfo(arguments.Folder), translationsService); }
public void CleanBackend(TranslateArguments arguments) { var(folder, service) = Setup(arguments, "backend"); Helper.CleanOtherLocales(service); service.Save(); }
public void CleanFrontend(TranslateArguments arguments) { var(_, service) = Setup(arguments, "frontend"); Helper.CleanOtherLocales(service); service.Save(); }
public void GenerateBackendKeys(TranslateArguments arguments) { var(backendFolder, serviceBackend) = Setup(arguments, "backend"); new GenerateKeys(backendFolder, serviceBackend, "backend_keys.json").Run(); var(frontendFolder, frontendService) = Setup(arguments, "frontend"); new GenerateKeys(frontendFolder, frontendService, "frontend_keys.json").Run(); }
private static (DirectoryInfo, TranslationService) Setup(TranslateArguments arguments, string fileName) { if (!Directory.Exists(arguments.Folder)) { throw new ArgumentException("Folder does not exist."); } var locales = new string[] { "en", "nl", "it" }; var translationsDirectory = new DirectoryInfo(Path.Combine(arguments.Folder, "backend", "i18n")); var translationsService = new TranslationService(translationsDirectory, fileName, locales, arguments.SingleWords); return(new DirectoryInfo(arguments.Folder), translationsService); }
public void GenerateFrontend(TranslateArguments arguments) { var(folder, service) = Setup(arguments, "frontend"); new GenerateFrontendResources(folder, service).Run(); }
public void Typescript(TranslateArguments arguments) { var(folder, service) = Setup(arguments, "frontend"); new TranslateTypescript(folder, service).Run(); }
public void Templates(TranslateArguments arguments) { var(folder, service) = Setup(arguments, "frontend"); new TranslateTemplates(folder, service).Run(arguments.Report); }
public void Backend(TranslateArguments arguments) { var(folder, service) = Setup(arguments, "backend"); new TranslateBackend(folder, service).Run(); }
public void CheckFrontend(TranslateArguments arguments) { var(folder, service) = Setup(arguments, "frontend"); new CheckFrontend(folder, service).Run(); }
public void MigrateFrontend(TranslateArguments arguments) { var(_, service) = Setup(arguments, "frontend"); service.Migrate(); }