Translating Data

Translating Data

Stored procedures, SQL queries, OData FunctionImports, and REST API can use the @DataLanguage or @data_language parameter to select data in the user's language.

Here is a sample SQL Server procedure that selects a company list:

CREATE PROCEDURE [s02].[xl_list_company_id]
    @data_language char(2) = NULL
AS
BEGIN

SET NOCOUNT ON

SELECT
    c.id
    , COALESCE(t.TRANSLATED_NAME, c.name) AS name
FROM
    s02.companies c
    LEFT OUTER JOIN xls.translations t ON t.TABLE_SCHEMA = 's02' AND t.TABLE_NAME = 'strings'
            AND t.LANGUAGE_NAME = @data_language AND t.COLUMN_NAME = c.name
ORDER BY
    name
    , id

END

@DataLanguage and @data_language are context parameters.

SaveToDB and DBEdit pass a data language selected in the Options dialog box.

DBGate and ODataDB give the language value from a URL.

For example, try these with DBGate:

or these with ODataDB: