6

I'm currently working on resources files to translate some texte.

I have the main "RevitString.resx" and "RevitString.fr-FR.resx". They both have the same keys with translated values and are in public.

I want to use them inside my c# code with the following code :

ResourceSet resourceSet = Resources.Languages.Tables.RevitString.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
type = (from ResourceDictionary x 
        in resourceSet 
        where x.Keys.ToString() == _type.Definition.ParameterGroup.ToString()
        select x.Values.ToString()).FirstOrDefault();

But when I run this, I got a null ResourceSet and when i look on the ResourceManager, "ResourceSets" is empty with count = 0.

What did I do wrong ?

I already wath some posts like this

Thank you!

Community
  • 1
  • 1
Thibaud
  • 377
  • 1
  • 2
  • 15

1 Answers1

2

Thanks to GibralterTop who gave me the good link.

Here is what I use know

ResourceSet resourceSet = Resources.Languages.Tables.RevitString.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
IDictionaryEnumerator enumerator = resourceSet.GetEnumerator();
while (enumerator.MoveNext())
{
switch(enumerator.Key)...
Thibaud
  • 377
  • 1
  • 2
  • 15