コード例 #1
0
        public InternationalizationFlow(ITranslationsService service)
        {
            _downloadTranslation = new RemoteActionsCallerForm(x =>
                                                               x.Add(
                                                                   () => _choose.ChosenValue,
                                                                   service.FetchTranslation,
                                                                   y => I18n.ConfigureImplementation(
                                                                       () => new TranslationWithFallbackI18n(_choose.ChosenValue.ToString(), y))));

            _choose = new EnumChoiceForm <SupportedLang>(
                "Language choice",
                true,
                SupportedLang.EN,
                x => x.GetLangName(),
                x => {
                x.Choice.Widget.Style.Display             = Display.Grid;
                x.Choice.Widget.Style.GridTemplateColumns = "auto 1fr";

                x.Description.Widget.InnerHTML =
                    @"For sake of simplicity you need to make explicit choice below. 
In a normal program, you would take current language either from logged in
user property or from browser's Accept-Language header field.
If you study source code you will see that messages eligible for translation are declared as: 
    I18n.Translate(""Some message that should be localized"")
Those messages can be easily found and translated within JSON file using <a target='_blank' href='https://github.com/d-p-y/oldschool-i18n'>OldSchool-I18n</a>";

                x.Description.Widget.Style.WhiteSpace    = WhiteSpace.Pre;
                x.Description.Widget.Style.PaddingBottom = "20px";
                x.Description.Widget.ClassName           = "grayedOut";
            });

            _welcomeDialog = new InformationalMessageForm();
        }
コード例 #2
0
        public MasterDetailsProgram(ISomeService someService)
        {
            _fetchData = new RemoteActionsCallerForm(x => {
                x.Add(someService.FetchHeaders, y => _headerItems.Replace(y));
                x.Add(someService.FetchDetails, y => _detailItems.Replace(y));
            });

            _headers = new HeadersForm();
            _details = new DetailsForm();

            _headerItems.Changed += (_, __, ___) => {
                _headers.Headers.Items.Replace(_headerItems);
            };
            _layoutChoice = new EnumChoiceForm <LayoutChoice>(
                "Choose screen layout", true, LayoutChoice.Horizontal, x => x.ToString(),
                x => x.Choice.Widget.ClassList.Add("horizontalOrVerticalChoice"));
        }