Can one local .resx line refer to another local .resx line?

I am trying to determine if a concatenated string can be added to one of my local .resx files. This example should clarify:

Let's say I have a simple ASP.NET web page consisting of (1) tags, the text of which is an important keyword (2), an input with the required field check and (3) a button that calls the check:

(lblMyInput)
(txtMyInput)
(rfvMyInput)
(btnSubmit)

Now, in the resource file for this page, we want to localize the strings for the page controls. However, for our error message we want to use the literal name of the input label. That was my question.

PSEUDOCODE: myPage.resx

(1) lblMyInput.Text = "Name"
(2) rfvMyInput.ErrorMessage = "The " + lblMyInput.Text + " field may not be left blank."
(3) btnSubmit.Text = "Submit/Validate"

Is there a way to remove this type of concatenation from one line of a resource file to another line in a single file?

Thank!

+3
2

- resx :

Resource1: "Hello, this is a {0}" Resource2: "Cookie"

Resource2 Resource1. , , {0}. , - . , .

+3

GetGlobalResourceObject .aspx

{0} .

, .aspx :

<asp:RequiredFieldValidator ruant="server" ID="rfvMyInput" ErrorMessage="<%= String.Format((string)GetGlobalResourceObject("GlobalResourceBaseName", "GlobalResourceKey"), lblMyInput.Text) %>" />

:

rfvMyInput.ErrorMessage=String.Format((string)GetGlobalResourceObject("GlobalResourceBaseName", "GlobalResourceKey"), lblMyInput.Text);

GlobalResourceBaseName GlobalResourceKey, , .

0

Source: https://habr.com/ru/post/1750731/


All Articles