RTL语言的AspnetBoilerplate Angular CLI开关CSS



我正在研究Aspnetboilerplate Angular 4项目,我想替换RTL语言的CSS文件。

如果由于Angular CLI生成的静态页面不可能,请让我知道如何为RTL语言选择其他index.html文件(例如,假设index-ar.html),取决于当前的语言,以下代码:

        app.Use(async (context, next) =>
        {
            await next();
            if (context.Response.StatusCode == 404
                && !Path.HasExtension(context.Request.Path.Value))
            {
                context.Request.Path = "/index.html";
                await next();
            }
        });

在上面的代码中,它始终选择index.html,因此我想检查当前语言并要设置通往" index-rtl.html"的路径。

我能够使用以下代码解决问题:

            if (context.Response.StatusCode == 404
                && !Path.HasExtension(context.Request.Path.Value))
            {
                string culture = "en";
                if (context.Request.Cookies.ContainsKey("Abp.Localization.CultureName"))
                {
                    culture = context.Request.Cookies["Abp.Localization.CultureName"];
                }
                if (context.Request.Path.Value == "app/ar" || culture=="ar")
                    context.Request.Path = "/ar/index.html";
                else
                    context.Request.Path = "/index.html";
                await next();
            }

我有两个索引文件,对于英语,我在wwwwroot文件夹中有文件,而对于wwwwroot ar文件夹中的阿拉伯语index.html文件。在角度上,我将"应用程序/ar"的路径设置为我的家庭组件,并且该解决方案非常有效。

最新更新