Tarscher
Tarscher

Reputation: 1933

circular dependency

I have 2 projects

The Ui project obviously needs a reference to the translation 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

Upvotes: 2

Views: 424

Answers (1)

Jamiec
Jamiec

Reputation: 136104

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);

Upvotes: 3

Related Questions