Using the global resource file instead of the page resources

Hi friends,

I know that Radzen uses the page based resx files. I try to find a way to use global resources files instead of locals.

Because, in this case, the same words must be declared many times for each page (even inside of the same page).

Some code-behind operations can be solution but I can't access some components directly such as heading or label etc.

Is it possible or is this wasting time?

Thank you for your support,
KB

Hi @koksal.basar,

There are no global resources at the moment - just for pages.

Hi @koksal.basar,

I am not sure if this is what you are looking for. But if you are using Visual Studio, right click the Shared project, select Properties, click Resources, select Strings, Add Resource, Access Modifier: Public, give the string a name and value. Then you can use the string in your code:

Hey @ggrewe
Thank you. I think this is what I'm looking for. I'll test it in a couple of days.

Thanks one more time,
KB

1 Like

Hello @ggrewe,

I have just been able to try your suggestion. When I add a shared project I can't access the project property page. (And I couldn't find a way to access) So I can't add the resource file. But I had tried adding resource files directly to the Radzen project instead of another project. It's working conceptionally. In this case, the resources are being acceable. But when Radzen recreates the codes the files are gone. The ignore list can be used in this case but I couldn't succeed in that. I asked that to the team. This question can be read from here.

I appreciate it if you have any suggestions.

Thanks,
KB

@koksal.basar

If the project is shared, you need to add the Shared project to the server project as a Dependency. Then, if the Resource has a Public Modifier, you should be able to access the string using the syntax below:
<Solution>.<Project>.Properties.Rescources.<ResourceName>
If that is not working for you, I would need to have access to your solution to diagnose the issue.

As far as Radzen removing the Resource files, if the solution that Atanas provided does not solve the issue, I am uncertain of a better solution.

Hi @ggrewe,

Your suggestion and @korchev's method (can check out from this page) are working together seamlessly (If the resource key used directly to the label, for example, Radzen design window shows [Expression] instead of the real word (or key). If you need the follow the resource keys on the screen you can create page properties and can use them.).

I changed a little your suggestion. In my scenario, I do not need a shared project. I'd added the resource files directly to the same project. I'd added the resx files in the Pages folder to the ignore list. Radzen doesn't create new resx files anymore for the new pages. The following syntax is enough to use resource keys.
Properties.Resources.<ResourceKey>
Because the resources are already in the same project.

I suggest this method to all Radzen users if they want to create a multilanguage / multicultural application.

Thanks,
KB