如何在.NET中进行极端的品牌/国际化 [英] How to do extreme branding/internationalization in .NET

查看:156
本文介绍了如何在.NET中进行极端的品牌/国际化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在计划一个相当大的应用程序。

We are planning a pretty big application.

-我们希望将我们的应用程序国际化到30个国家/地区。

-We want to internationalize our application for 30 countries.

-在大多数国家/地区,可以使用1至6个不同的品牌。

-In most countries 1 to 6 different brands are available.

-某些语言环境(例如 de)和品牌(例如 XXX)的每种组合可能会多次出现因此,我们需要另一个标识符来获取独特的内容:

-Each combination of a certain locale like 'de' and brand like 'XXX' might occur multiple times therefore we need another identifier to get something unique:

"locale_brand_siteorigin"

因此,我们有.resx文件,例如:

Therefore we have .resx file like:

配置。 de.burgerking.px10 .resx

粗体字是唯一标识符。

在运行时,我们创建: / p>

During runtime we create a:

var rm = new ResourceManager("MyNamespace.Configurations.UniqueIdentifier",Assembly.GetExecuting());

根据我们的业务逻辑,我们可以创建上面的resourceManager。

Depending on our business logic we can create the above resourceManager.

最后,我们最终将拥有180多个带有唯一标识符所有组合的resx文件。

Finally we will end up having 180+ resx files with all combinations of the unique identifier.

您知道这样做的更好方法吗?

Do you know of a better way to do this kind of branding?

4年前有人问过这个问题,但没有人回答:

4 years ago someone asked this question, but none answered:

实施应用程序品牌推广的行业标准?

更新

我也想扩展我的问题,寻求一个解决方案,以显示使用 cultureandregioninfobuilder 类的好处来创建许多自定义文化。

I also want to extend my question asking for a solution showing the benefits of using the cultureandregioninfobuilder class to create those many custom cultures.

https://msdn.microsoft.com/zh-cn/library /system.globalization.cultureandregioninfobuilder(v=vs.110).aspx

推荐答案

我不建议使用.resx文件可用于如此庞大的项目。当网站以多种不同的语言翻译时,通常很多人都参与复制管理,翻译等工作。这些人将无法编辑.resx文件,因为它们在技术上已嵌入到应用程序代码中。这意味着您的开发人员每次更改时都必须不断更新资源……每个人的噩梦。

I wouldn't recommend using .resx files for such a huge project. When a website is translated in many different languages, usually a lot of people are involved in the copy management, translation etc. These people will not be able to edit the .resx files since they are technically embedded in the application code. This means that your developers will have to constantly update the resources every time there are changes... a real nightmare for everybody.

我最近为以下项目构建了数据库驱动的系统 SumoSoft.Cms 。所有字符串都可以通过管理面板进行管理,而在代码中,您只需使用:

I recently build a database-driven system for the SumoSoft.Cms. All the strings can be managed through the Admin panel, while in the code you just use:

@CmsMethods.StringContent("ContentSection_Name", "Fallback_Value")

此帮助器查询数据库以查找类型为 ContentSection的实体的结构大致如下:

This Helper queries the Database looking for an entity of Type "ContentSection" which is structured more or less like this:

public class ContentSection
{
    public string Name { get; set; }

    public ICollection<ContentSectionLocalizedString> LocalizedStrings { get; set; }
}

每个LocalizedString都包含对特定国家/地区的引用以及内容属性,因此,帮助程序所做的就是选择与当前线程文化相匹配的内容。

Each LocalizedString contains a reference to a specific Country and a property "Content", so all the Helper does is to choose the one that matches the Current Culture of the Thread.

这篇关于如何在.NET中进行极端的品牌/国际化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆