コード例 #1
0
ファイル: Localization.cs プロジェクト: seljmov/Semantic-IDE
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var keyToUse = Key;

            if (!string.IsNullOrWhiteSpace(Context))
            {
                keyToUse = $"{Context}/{Key}";
            }

            var binding = new ReflectionBindingExtension($"[{keyToUse}]")
            {
                Mode   = BindingMode.OneWay,
                Source = Localizer.GetInstance(),
            };

            return(binding.ProvideValue(serviceProvider));
        }
コード例 #2
0
        private void initializeLocalization()
        {
            // TODO:: plug in other localized strings - everything's in EN-US right now.
            localizer = Localizer.GetInstance("Localization/firebase_auth_enus", "Localization/firebase_auth_enus");

            // Initialize controllers with generic localization:
            modal.Initialize(this);
            loginUI.Initialize(this);
            registrationUI.Initialize(this);

            // Override any generic localization:
            loginUI.PromptMessage         = localizer.GetLocalized("sign_in_with_email_and_password");
            loginUI.ConfirmButtonLabel    = localizer.GetLocalized("log_in");
            loginUI.NavigationButtonLabel = localizer.GetLocalized("or_register");

            registrationUI.PromptMessage         = localizer.GetLocalized("sign_up_with_email_and_password");
            registrationUI.ConfirmButtonLabel    = localizer.GetLocalized("continue");
            registrationUI.NavigationButtonLabel = localizer.GetLocalized("cancel");
        }
コード例 #3
0
        public override IDock CreateLayout()
        {
            // - В будущем текущий язык среды будет подгружаться с файла
            Localizer.GetInstance().LoadLanguage("en-EN");
            var Dict = Semantic.Scripts.Localizer.GetInstance().Strings;

            // - Подготовка панелей для объединения в layout
            // - Страница "Добро пожаловать"
            var welcome = new WelcomeViewModel
            {
                Id    = "Welcome",
                Title = Dict["WelcomePage"]
            };

            // - Панель "Проект"
            var project = new ProjectViewModel
            {
                Id    = "Project",
                Title = Dict["Project"]
            };

            // - Панель "Задачник"
            var taskbook = new TaskbookViewModel
            {
                Id    = "Taskbook",
                Title = Dict["Taskbook"]
            };

            // - Панель "Документация"
            var help = new HelpViewModel
            {
                Id    = "Help",
                Title = Dict["Help"]
            };

            // - Панель "Ошибки"
            var errors = new ErrorsViewModel
            {
                Id    = "Errors",
                Title = Dict["ErrorsList"]
            };

            // - Панель "Журнал команд"
            var commandLog = new CommandLogViewModel
            {
                Id    = "CommandLog",
                Title = Dict["CommandLog"]
            };

            // - Панель "Консоль"
            var console = new ConsoleViewModel
            {
                Id    = "Console",
                Title = Dict["Console"]
            };

            // - Делим layout на две части: нижнюю и верхнюю
            var mainLayout = new ProportionalDock
            {
                Id               = "MainLayout",
                Title            = "MainLayout",
                Proportion       = double.NaN,
                Orientation      = Orientation.Vertical,
                ActiveDockable   = null,
                VisibleDockables = CreateList <IDockable>
                                   (
                    // - Верхняя часть содержит проект, задачник, докум-ю и редактор кода
                    new ProportionalDock
                {
                    Id               = "UpperPart",
                    Title            = "UpperPart",
                    Proportion       = double.NaN,
                    Orientation      = Orientation.Horizontal,
                    ActiveDockable   = null,
                    VisibleDockables = CreateList <IDockable>
                                       (
                        new ToolDock
                    {
                        Id               = "UpperTool1",
                        Title            = "UpperTool1",
                        Proportion       = double.NaN,
                        ActiveDockable   = project,
                        VisibleDockables = CreateList <IDockable>
                                           (
                            project,            // - Вкладка со структурой проекта
                            taskbook,           // - Вкладка с задачами
                            help                // - Вкладка с документацией
                                           )
                    },
                        new SplitterDock
                    {
                        Id    = "UpperSplitter",
                        Title = "UpperSplitter"
                    },
                        new DocumentDock
                    {
                        Id               = "DocumentPane",
                        Title            = "DocumentPane",
                        Proportion       = double.NaN,
                        ActiveDockable   = welcome,
                        VisibleDockables = CreateList <IDockable>(welcome)
                    }
                                       )
                },
                    // - Разделитель частей
                    new SplitterDock
                {
                    Id    = "LayoutSplitter",
                    Title = "LayoutSplitter"
                },
                    // - Нижняя часть содержит ошибки, журнал команд и консоль
                    new ProportionalDock
                {
                    Id               = "LowerPart",
                    Title            = "LowerPart",
                    Proportion       = double.NaN,
                    Orientation      = Orientation.Horizontal,
                    ActiveDockable   = null,
                    VisibleDockables = CreateList <IDockable>
                                       (
                        new ToolDock
                    {
                        Id               = "LowerTool1",
                        Title            = "LowerTool1",
                        Proportion       = double.NaN,
                        ActiveDockable   = errors,
                        VisibleDockables = CreateList <IDockable>
                                           (
                            errors,
                            commandLog
                                           )
                    },
                        new SplitterDock
                    {
                        Id    = "LowerSplitter",
                        Title = "LowerSplitter"
                    },
                        new ToolDock
                    {
                        Id               = "LowerTool2",
                        Title            = "LowerTool2",
                        Proportion       = double.NaN,
                        ActiveDockable   = console,
                        VisibleDockables = CreateList <IDockable>(console)
                    }
                                       )
                }
                                   )
            };

            var mainView = new MainViewModel
            {
                Id               = "MainView",
                Title            = "MainView",
                ActiveDockable   = mainLayout,
                VisibleDockables = CreateList <IDockable>(mainLayout)
            };

            var root = CreateRootDock();

            root.Id               = "Root";
            root.Title            = "Root";
            root.ActiveDockable   = mainView;
            root.DefaultDockable  = mainView;
            root.VisibleDockables = CreateList <IDockable>(mainView);

            return(root);
        }