public void WebLocalizationTest() { using (var cc = TestCommon.CreateClientContext(centralSubSiteUrl)) { CleanUpTestData(cc); ProvisioningTemplateCreationInformation ptci = new ProvisioningTemplateCreationInformation(cc.Web); ptci.PersistMultiLanguageResources = true; ptci.FileConnector = new FileSystemConnector(string.Format(@"{0}\..\..\Framework\Functional", AppDomain.CurrentDomain.BaseDirectory), "Templates"); ptci.HandlersToProcess = Handlers.Fields | Handlers.ContentTypes | Handlers.Lists | Handlers.SupportedUILanguages | Handlers.CustomActions; var result = TestProvisioningTemplate(cc, "localization_add.xml", Handlers.Fields | Handlers.ContentTypes | Handlers.Lists | Handlers.SupportedUILanguages | Handlers.CustomActions, null, ptci); LocalizationValidator Validator = new LocalizationValidator(); Assert.IsTrue(Validator.Validate(result.SourceTemplate, result.TargetTemplate, result.SourceTokenParser, result.TargetTokenParser)); } }
internal void SiteCollectionsLocalization(string url) { using (var cc = TestCommon.CreateClientContext(url)) { CleanUpTestData(cc); ProvisioningTemplateCreationInformation ptci = new ProvisioningTemplateCreationInformation(cc.Web) { BaseTemplate = null, PersistMultiLanguageResources = true, FileConnector = new FileSystemConnector(string.Format(@"{0}\..\..\..\Framework\Functional", AppDomain.CurrentDomain.BaseDirectory), "Templates"), HandlersToProcess = Handlers.Fields | Handlers.ContentTypes | Handlers.Lists | Handlers.SupportedUILanguages | Handlers.CustomActions | Handlers.Pages | Handlers.Files | Handlers.Navigation }; var result = TestProvisioningTemplate(cc, "localization_add.xml", ptci.HandlersToProcess, null, ptci); LocalizationValidator validator = new LocalizationValidator(cc.Web); Assert.IsTrue(validator.Validate(result.SourceTemplate, result.TargetTemplate, result.SourceTokenParser, result.TargetTokenParser, cc.Web)); } }
public static void Register(CommandLineApplication app) { app.Command("localization", localizationValidator => { localizationValidator.Description = Description; localizationValidator.HelpOption(HelpOption); var vsixSwitch = localizationValidator.Option( "-x|--vsix", VsixSwitchDescription, CommandOptionType.NoValue); var vsixPath = localizationValidator.Option( "-p|--vsix-path", VsixPathDescription, CommandOptionType.SingleValue); var vsixExtractPath = localizationValidator.Option( "-e|--vsix-extract-path", VsixExtractPathDescription, CommandOptionType.SingleValue); var outputPath = localizationValidator.Option( "-o|--output-path", OutputPathDescription, CommandOptionType.SingleValue); var commentsPath = localizationValidator.Option( "-c|--comments-path", CommentsPathDescription, CommandOptionType.SingleValue); var artifactsPath = localizationValidator.Option( "-a|--artifacts-path", ArtifactsPathDescription, CommandOptionType.SingleValue); localizationValidator.OnExecute(() => { var exitCode = 0; if (vsixSwitch.HasValue()) { if (!vsixPath.HasValue() || !vsixExtractPath.HasValue() || !outputPath.HasValue()) { Console.WriteLine("Since -x|--vsix switch was passed, please enter the following arguments - "); Console.WriteLine($"{vsixPath.ShortName}|{vsixPath.LongName}: {vsixPath.Description}"); Console.WriteLine($"{vsixExtractPath.ShortName}|{vsixExtractPath.LongName}: {vsixExtractPath.Description}"); Console.WriteLine($"{outputPath.ShortName}|{outputPath.LongName}: {outputPath.Description}"); exitCode = 1; } else { exitCode = LocalizationValidator.ExecuteForVsix(vsixPath.Value(), vsixExtractPath.Value(), outputPath.Value(), commentsPath.Value()); } } else { if (!artifactsPath.HasValue() || !outputPath.HasValue()) { Console.WriteLine("Since -x|--vsix switch was not passed, please enter the following arguments - "); Console.WriteLine($"{artifactsPath.ShortName}|{artifactsPath.LongName}: {artifactsPath.Description}"); Console.WriteLine($"{outputPath.ShortName}|{outputPath.LongName}: {outputPath.Description}"); exitCode = 1; } else { exitCode = LocalizationValidator.ExecuteForArtifacts(artifactsPath.Value(), outputPath.Value(), commentsPath.Value()); } } return(exitCode); }); }); }