コード例 #1
0
        private void InitLocalization()
        {
            CultureInfo currentCultureInfo = localizeService.GetCurrentCultureInfo();

            AppResources.Culture = currentCultureInfo;
            localizeService.SetLocale(currentCultureInfo);
        }
コード例 #2
0
ファイル: App.cs プロジェクト: maxlandry/mobile
        private void SetCulture()
        {
            Debug.WriteLine("====== resource debug info =========");
            var assembly = typeof(App).GetTypeInfo().Assembly;

            foreach (var res in assembly.GetManifestResourceNames())
            {
                Debug.WriteLine("found resource: " + res);
            }
            Debug.WriteLine("====================================");

            // This lookup NOT required for Windows platforms - the Culture will be automatically set
            if (Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Android)
            {
                var ci = _localizeService.GetCurrentCultureInfo();
                AppResources.Culture = ci;
                _localizeService.SetLocale(ci);
            }
        }
コード例 #3
0
ファイル: App.cs プロジェクト: sentientpc/bitwarden-mobile
        private void SetCulture()
        {
            Debug.WriteLine("====== resource debug info =========");
            var assembly = typeof(App).GetTypeInfo().Assembly;

            foreach (var res in assembly.GetManifestResourceNames())
            {
                Debug.WriteLine("found resource: " + res);
            }
            Debug.WriteLine("====================================");

            // This lookup NOT required for Windows platforms - the Culture will be automatically set
            if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android)
            {
                var ci = _localizeService.GetCurrentCultureInfo();
                AppResources.Culture = ci;
                _localizeService.SetLocale(ci);
            }

            // Calendars are removed by linker. ref https://bugzilla.xamarin.com/show_bug.cgi?id=59077
            new System.Globalization.ThaiBuddhistCalendar();
            new System.Globalization.HijriCalendar();
            new System.Globalization.UmAlQuraCalendar();
        }
コード例 #4
0
        public static string Translate(this ILocalizeService localizeService, string str)
        {
            var tranlation = AppResources.ResourceManager.GetString(str, localizeService.GetCurrentCultureInfo());

            return(string.IsNullOrEmpty(tranlation) ? str : tranlation);
        }
コード例 #5
0
 public TranslateService(ILocalizeService localizeHelper)
 {
     ci = localizeHelper.GetCurrentCultureInfo();
 }