I want to add some search lists to the database, but I want them to be easily localized (SQL 2005, ADO.NET)
This will include:
- Easily manage multiple languages at once
- Easy retrieval of values from a database
- Exceptional language (in the absence of a selected language)
I thought about a table that will store a multilingual search list (using the same identifier for different languages), and use a function that will return the value of the search list - by getting the identifier and Language.
One of the problems is that I have to manually add a language setting for each query that uses a search list.
I am looking for a solution that would allow me to send a parameter as "session / global variable" or send this parameter automatically using an SQL query, and the function to receive it by itself (or to attach a parameter automatically to be able to read the parameter).
The solution may look something like this, but I don’t mind if it is different, if it does not explicitly set the Query parameter (pseudocode):
1. Send the language using "the method"
2. Execute Query
3. Get the localized results
Clarification:
Typically, a query will look like this (remember, using the search function):
SELECT .., GetLookupList1(lookup_ID, language), .. FROM TABLE
GetLookupList1 is a user-defined function that retrieves the search value for a lookup table. Using this feature, SQL code is easier to read and maintain.
The body of the function will look something like this:
SELECT @result = LookupValue FROM LookupTable1 WHERE ID=@Lookup_ID and Language=@lang
RETURN @result
, - , //,
SELECT .., GetLookupList1(lookup_ID), .. FROM TABLE