public static ITranslateContentClient Create( IPlatformComponentsFactory platformComponentsFactory, RemoteContentConfig contentConfig, OfflineContentConfig offlineContentConfig) { return(new OfflineRemoteTranslateContentClient(platformComponentsFactory, contentConfig, offlineContentConfig)); }
public OfflineRemoteTranslateContentClient( IPlatformComponentsFactory platformComponentsFactory, RemoteContentConfig contentConfig, OfflineContentConfig offlineContentConfig) : base(platformComponentsFactory, contentConfig) { this.offlineContentConfig = offlineContentConfig; }
public void SetUp() { var remoteConfig = new RemoteContentConfig { CacheDir = Path.GetTempPath() }; var hostAssembly = this.GetType().Assembly; this.offlineContentConfig = OfflineContentConfig.FromAssembly(hostAssembly, "en.yaml", "Locales"); this.offlineRemoteTranslateContentClient = new OfflineRemoteTranslateContentClient( new PlatformComponentsFactory(), remoteConfig, this.offlineContentConfig); }
protected override void ReloadLocale() { var remoteConfig = new RemoteContentConfig { Locales = { { "ru", "https://raw.githubusercontent.com/kvandake/friendly-locale/master/Sample.Basic/FriendlyLocale.Sample.Core/Locales/ru.yaml" }, { "en", "https://raw.githubusercontent.com/kvandake/friendly-locale/master/Sample.Basic/FriendlyLocale.Sample.Core/Locales/en.yaml" } } }; // assembly offline locale var assembly = this.GetType().GetTypeInfo().Assembly; var offlineConfig = OfflineContentConfig.FromAssembly(assembly, "ru.yaml", "Locales"); I18N.Initialize(remoteConfig, offlineConfig); this.ReloadItems(); }
public async Task Chech_OfflineLocale() { // Arrange var hostAssembly = this.GetType().Assembly; var offlineConfig = OfflineContentConfig.FromAssembly(hostAssembly, "en.yaml", "Locales"); var remoteConfig = new RemoteContentConfig { CacheDir = Path.GetTempPath() }; I18N.Initialize(remoteConfig, offlineConfig); // Act var offlineLocale = I18N.Instance.GetLocale("offline"); await I18N.Instance.ChangeLocale(offlineLocale); var value = I18N.Instance.Translate("ViewModel.Locale"); // Assert Assert.NotNull(offlineLocale); Assert.AreEqual("en", value); }
public OfflineLocale(OfflineContentConfig config) { this.config = config; }
public static void Initialize(RemoteContentConfig contentConfig, OfflineContentConfig offlineContentConfig) { InitializeInternal(TranslateContentClientFactory .Create(CreatePlatformComponentsFactory(), contentConfig, offlineContentConfig)); }