示例#1
0
            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);
            }
示例#2
0
            public void CleanBackend(TranslateArguments arguments)
            {
                var(folder, service) = Setup(arguments, "backend");

                Helper.CleanOtherLocales(service);

                service.Save();
            }
示例#3
0
            public void CleanFrontend(TranslateArguments arguments)
            {
                var(_, service) = Setup(arguments, "frontend");

                Helper.CleanOtherLocales(service);

                service.Save();
            }
示例#4
0
            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();
            }
示例#5
0
            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);
            }
示例#6
0
            public void GenerateFrontend(TranslateArguments arguments)
            {
                var(folder, service) = Setup(arguments, "frontend");

                new GenerateFrontendResources(folder, service).Run();
            }
示例#7
0
            public void Typescript(TranslateArguments arguments)
            {
                var(folder, service) = Setup(arguments, "frontend");

                new TranslateTypescript(folder, service).Run();
            }
示例#8
0
            public void Templates(TranslateArguments arguments)
            {
                var(folder, service) = Setup(arguments, "frontend");

                new TranslateTemplates(folder, service).Run(arguments.Report);
            }
示例#9
0
            public void Backend(TranslateArguments arguments)
            {
                var(folder, service) = Setup(arguments, "backend");

                new TranslateBackend(folder, service).Run();
            }
示例#10
0
            public void CheckFrontend(TranslateArguments arguments)
            {
                var(folder, service) = Setup(arguments, "frontend");

                new CheckFrontend(folder, service).Run();
            }
示例#11
0
            public void MigrateFrontend(TranslateArguments arguments)
            {
                var(_, service) = Setup(arguments, "frontend");

                service.Migrate();
            }