Bonjour à jour,
svp j'ai créé une dll de traduction en c# 2.0 .
Elle contient une methode.
//strLang=langue par example "en" et strKey est mot à traduire
public static string Traduire(string strLang,
string strKey)
{
string strTrans = "";
try
{
// Changes the CurrentUICulture of the current thread to strLang
Thread.CurrentThread.CurrentUICulture = new CultureInfo(strLang,false);
ResourceManager res = new ResourceManager(ConfigurationSettings.AppSettings["NomAppli"].ToString() + ".Ressurces",
Assembly.GetExecutingAssembly());
strTrans = res.GetString(strKey);
res = null;
}
catch (Exception ex)
{
strTrans= "Pas de traduction!";
}
return strTrans ;
}
le but est d'utilier cette Dll dans diverses application pour centraliser l'opération de traduction.
(cette methode fonctionne bien lorsque la classe fait partir de mon projet).
Le problème c'est que lorsque j'utilise la DLL dans une application windows dans lequel jai défini "NomAppli" dans app.config,
j'obtiens le message d'erreur:
System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "MonAppli.Ressource.resources"
was correctly embedded or linked into assembly "Total.RM.AP" at compile time, or that all the satellite assemblies required are loadable and fully signed.
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
at System.Resources.ResourceManager.GetString(String name)
Apparemment la ResourceManager ne peux etre reccuperée à partir d'une DLL,meme referencé dans l'appli cliente.
svp j'espere m'etre fait comprendre et je ne sais pas si vous auriez une solution à proposer.
Merci
Ruth