AudienceView Connect
AudienceView Documentation

Populating Multi-Language List Entries with English Values

A new language column is added to the General Configuration application Lists|Entries page, however the new column is not automatically populated. The following script populates the empty French fields with the correponding English entries.

Warning
Entries should not be left blank. Some list entries may not be customer facing, and, therefore, may not necessarily get translated and entered into the appropriate field. This could cause problems where the effected lists apply.

To run the script, complete the following:

  1. Open Microsoft SQL Server Management.
  2. Click 'New Query'.
    A new query appears.
  3. Select your database from the 'Available Databases' dropdown.
  4. Copy (CTRL+C) and paste (CTRL+V) the below script into the SQL server query.
  5. If you are configuring English and French, proceed to Step 9.
  6. If you are configuring any other language, proceed to Step 7
  7. Press CTRL+F and search for 'FR'.
  8. Replace both instances of 'FR' with the exact abbreviation that was defined in the Registry (in single quotes).
    For more information, refer to Multi-Language Registry Configuration.
  9. Click 'Execute'.
    The script is run and the language fields are populated with the English entries.
  10. For every additional language that you want to configure, repeat the process from Step 7.
declare @main_language nvarchar(50);
declare @child_language nvarchar(50);

set @main_language = 'EN'
set @child_language = 'SW'

delete from ts_list_entries
where list_entry_language = @child_language

select
list_entry_id as le_id,
english_language,
other_language,
list_entry_language
into #tmp_list_entry_lang_count
from
(
    select
    le_list_id,
    le_key collate SQL_Latin1_General_CP1_CS_AS as le_key,
    max(english_language) as english_language,
    max(other_language) as other_language

      from
      (
            select
               list_entry_list_id as le_list_id,
               list_entry_key as le_key, list_entry_language,
            case when list_entry_language = @main_language then 1 else 0 end as english_language,
            case when list_entry_language = @child_language then 1 else 0 end as other_language
            from ts_list_entries
      ) as list_entry_lang_count
      group by
      le_list_id,
      le_key collate SQL_Latin1_General_CP1_CS_AS

) as unique_list_entry_lang_count
inner join ts_list_entries on list_entry_list_id = le_list_id and list_entry_key = le_key
where not(other_language = 1 and english_language = 1)
and list_entry_language not in(
      select registrynode_name from ts_registry_node
      where registrynode_parent_node_id is NULL
      and registrynode_table = 'R'
      and registrynode_name != @main_language
)

-- delete non-english entries that don't have an correspoding english entry
delete from ts_list_entries
where list_entry_id in (select le_id from #tmp_list_entry_lang_count where other_language = 1 and english_language = 0)


-- Save Copy entries that only have an english entry but don't have a corresponding non-english entry
INSERT INTO [ts_list_entries]
           (
           [list_entry_record_state]
           ,[list_entry_audit_id]
           ,[list_entry_create_audit_id]
           ,[list_entry_list_id]
           ,[list_entry_id]
           ,[list_entry_language]
           ,[list_entry_key]
           ,[list_entry_label]
           ,[list_entry_unique_label]
           ,[list_entry_sort_hint]
           ,[list_entry_status]
           ,[list_entry_version]
           )
select
           0
           ,'{00000000-0000-0000-0000-000000000000}'
           ,'{00000000-0000-0000-0000-000000000000}'
           ,[list_entry_list_id]
           ,newid()
           ,@child_language
           ,[list_entry_key]
           ,[list_entry_label]
           ,[list_entry_unique_label]
           ,[list_entry_sort_hint]
           ,[list_entry_status]
           ,0
from ts_list_entries
inner join #tmp_list_entry_lang_count on le_id = list_entry_id
where other_language = 0 and english_language = 1
go

drop table #tmp_list_entry_lang_count
go