Hello All,

We have a lot of labels and strings in our application which supports multiple languages. Thus, we need to add them in to our application. I have observed that the Key and Value pairs are added to T_BDF_DOMAINDTL, T_BDF_DOMAINDTLDSP tables respectively. Is it possible to add Multilingual strings using an api provided with formspider. This functionality would be useful as we have lot of strings to be added.



asked 05 Jul '13, 09:26

suranga's gravatar image

accept rate: 0%

Hi Suranga,

Below a procedure that will create a key and a translation in Formspider. First create the language in Formspider IDE - Menu Multilingual - Languages.

Best regards, Michiel A.

--p_key_cd_i      => the key string that needs to be translated    
--p_lang_cd_i     => the language code (as created with the formspider language)
--p_local_cd_i    => the language local (as created with the formspider language) 
--p_translation_i => the translation in the given language
--p_app_id_i      => the formspider bdf_application_oid for your aplication (as in table T_BDF_APPLICATION)
procedure insert_translation (p_key_cd_i      in varchar2
                             ,p_lang_cd_i     in varchar2
                             ,p_local_cd_i    in varchar2
                             ,p_translation_i in varchar2
                             ,p_app_id_i      in number
   g_bdf_domain_oid      number; 
   g_bdf_application_oid number;

   l_lang_oid            number;
   l_ddl_oid             number;
   l_ddp_oid             number;
   l_dummy               number;

   e_invalid_language    exception;

   cursor c_lang (b_code  in varchar2
                 ,b_local in varchar2
      select lge.bdf_language_oid  id
      from   fsr_sys.t_bdf_language lge
      where  lge.language_cd         = b_code
      and    lge.local_cd            = b_local
      and    lge.bdf_application_oid = g_bdf_application_oid

   cursor c_ddl (b_key_code in varchar2)
      select ddl.bdf_domaindtl_oid   id
      from   fsr_sys.t_bdf_domaindtl ddl
      where  ddl.bdf_domain_oid = g_bdf_domain_oid
      and    ddl.key_cd         = b_key_code

   cursor c_ddp (b_lang_id in number
                ,b_ddl_id  in number
      select 1
      from   fsr_sys.t_bdf_domaindtldsp ddp
      where  ddp.bdf_domaindtl_oid = b_ddl_id
      and    ddp.bdf_language_oid  = b_lang_id

   g_bdf_application_oid := p_app_id_i;
   l_dummy               := 0;

   -- get language oid
   open  c_lang (b_code  => p_lang_cd_i
                ,b_local => p_local_cd_i
   fetch c_lang
   into  l_lang_oid;
   close c_lang;

   if l_lang_oid is null
      raise e_invalid_language;
   end if;

   -- fetch translation domain
   select dmn.bdf_domain_oid
   into   g_bdf_domain_oid
   from   fsr_sys.t_bdf_domain dmn
   where  dmn.bdf_application_oid = p_app_id_i
   and    dmn.domaintype_cd       = 'Multilingual'

   -- fetch existing bdf_domaindtl_oid
   open  c_ddl (b_key_code => lower (p_key_cd_i));
   fetch c_ddl
   into  l_ddl_oid;
   close c_ddl;

   if l_ddl_oid is null
      select fsr_sys.bdf_object_seq.nextval
      into   l_ddl_oid
      from   dual;

      -- create a new domain detail
      insert into fsr_sys.t_bdf_domaindtl ddl
         ,lower (p_key_cd_i)

   end if; -- l_ddl_oid is null

   -- check if there already is a translation for the given language
   open  c_ddp (b_lang_id => l_lang_oid
               ,b_ddl_id  => l_ddl_oid
   fetch c_ddp
   into  l_dummy;
   close c_ddp;

   if l_dummy <> 1
      select fsr_sys.bdf_object_seq.nextval
      into   l_ddp_oid
      from   dual;

      -- create a new domain detail
      insert into fsr_sys.t_bdf_domaindtldsp ddp
   end if;

   when e_invalid_language
      api_error.log ('Cannot find Formspider language for given language code '''||p_lang_cd_i||'''and locale '''||p_local_cd_i||''' ');

end insert_translation;

answered 05 Jul '13, 11:47

Michiel%20A's gravatar image

Michiel A
accept rate: 13%

Hi Suranga, Michiel's answer shows how you can populate the multilingual keys programmatically. Thanks Michiel. :-).


(05 Jul '13, 11:51) Yalim ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 05 Jul '13, 09:26

Seen: 3,183 times

Last updated: 05 Jul '13, 11:51

© Copyright Gerger 2017