开发者

circular dependency

I have 2 projects

  • UI: contains all my forms and user control
  • Translation: contains my translation code used to translate the UI

The Ui project obviously needs a reference to the translation 开发者_StackOverflow社区project since it needs translation.

Since I defined custom user controls in the UI that need special translation. The Translation project needs to know the type and thus translation also needs a reference to UI resulting in a circular dependency.

is this actually a problem and yes how do I solve this best? Do I take out the custom types and put them in a seperate project?

Thanks


Following good practice, and especially sepatation of concerns, your translation library should know nothing about what it is translating, only that it needs to translate text a into b.

Typically this is done with a methods or methods which take an identifier for a string, and a culture to translate to.

CultureInfo ci = new CultureInfo("en-US");
var tranlated = MyTranslator.Translate("HelloWorldMessage",ci);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜