使用 westwind globalization 在 ASP MVC 中部署新的生产翻译

Deploy new translations on production in ASP MVC with westwind globalization

我正在我的 asp mvc 应用程序中使用 westwind globalization 添加全球化,该应用程序已经 运行 在生产服务器上(Git,具有持续交付功能的 TeamCity)。

如果流程如下我想达到的效果:

我想到的唯一解决方案是使用 EF 迁移(应用程序首先使用 EF 代码):

有什么想法吗?

我最终得到了不同的解决方案: 我为创建初始翻译的 DbRes.T 方法创建了一个包装器。

编辑: 有关解决方案的更多详细信息。

我创建了一个静态 class 翻译,其中包含视图中使用的一些方法。 第一次调用默认值后添加。 其中一个看起来像这样:

public static string 
    Translate(string resourceSet, string key, string defaultEnglish)
    {
        var currentLang = GetValidCurrentCulture();

        var resourceValue = DbRes.TDefault(key, null, resourceSet, currentLang);
        if (resourceValue == null)
        {
            AddDefaultTranslations(resourceSet, key, defaultEnglish);
        }

        if (string.IsNullOrWhiteSpace(resourceValue))
        {
            return defaultEnglish;
        }

        return resourceValue;
    }