How to select a string in resx (internationalization) without using the static method

Asked

Viewed 56 times

0

I have . resx files where I store strings in English and Portuguese, in my database I have the following table: Banco de dados 1

And I want to change the description of the plans equal the first record of this table: Banco de dados 2

With this I can take this string "plano_1" straight from my Source thus managing to transform it into English and Portuguese.

But since Resource only lets me take the static methods with the strings inside, I can’t solve this problem.

I wish instead of doing this : string plano1 = Messages.plano_1; use the string I’m going to pull from the database something like string plano1 = Messages("plano_1").

1 answer

2


You can use the ResourceManager.GetString for that reason

var resManager = Messages.ResourceManager;
string plano1 = resManager.GetString("plano_1");

Browser other questions tagged

You are not signed in. Login or sign up in order to post.