コード例 #1
0
        public async Task Check_DownloadContent()
        {
            // Arrange
            var remoteConfig = new RemoteContentConfig
            {
                CacheDir = Path.GetTempPath()
            };

            var localConfig = new AssetsContentConfig
            {
                ResourceFolder = remoteConfig.CacheDir
            };

            if (!Directory.Exists(localConfig.ResourceFolder))
            {
                Directory.CreateDirectory(localConfig.ResourceFolder);
            }

            this.assetsTranslateContentClient =
                new AssetsTranslateContentClient(new PlatformComponentsFactory(), localConfig);
            var remoteTranslateContentClient = new RemoteTranslateContentClient(new PlatformComponentsFactory(), remoteConfig);
            var remoteLocale = new RemoteLocale("ru", RemoteTranslateContentClientTests.TestLocaleUrl);
            await remoteTranslateContentClient.GetContent(remoteLocale, null);

            var locales = this.assetsTranslateContentClient.GetLocales();

            // Act
            var content = await this.assetsTranslateContentClient.GetContent(locales.First(), null, CancellationToken.None);

            // Assert
            Assert.IsNotEmpty(content);
        }
コード例 #2
0
        protected override void ReloadLocale()
        {
            var localeConfig = new AssetsContentConfig
            {
                ResourceFolder = "Locales"
            };

            FriendlyLocale.I18N.Initialize(localeConfig);
            this.ReloadItems();
        }
コード例 #3
0
 public static ITranslateContentClient Create(
     IPlatformComponentsFactory platformComponentsFactory,
     AssetsContentConfig contentConfig)
 {
     return(new AssetsTranslateContentClient(platformComponentsFactory, contentConfig));
 }
コード例 #4
0
 public AssetsTranslateContentClient(IPlatformComponentsFactory platformComponentsFactory, AssetsContentConfig contentConfig)
 {
     this.platformResourceFileManager = platformComponentsFactory.CreateResourceFileManager();
     this.contentConfig = contentConfig;
 }
コード例 #5
0
 public MvxYamlTextProvider(AssetsContentConfig config)
 {
     I18N.Initialize(config);
 }
コード例 #6
0
 public static void Initialize(AssetsContentConfig contentConfig)
 {
     InitializeInternal(TranslateContentClientFactory.Create(CreatePlatformComponentsFactory(), contentConfig));
 }