Forums

Forums / Developing Portals / Get Language Code Mapping in Code-behind (C#)

Get Language Code Mapping in Code-behind (C#)

4 posts, 1 answered
  1. Dmitriy Razumov_2
    Dmitriy Razumov_2 avatar
    31 posts
    Registered:
    20 Jul 2020
    20 Jul 2020
    Link to this post
    Hello,

    Could you please tell me how can I get the language code mappings (CRM/Sitefinity) (https://www.crmportalconnector.com/developer-network/documentation/how-tos/mvc-based-widgets/how-to-configure-language-mapping ) to compare them in my code?

    Thank you.
  2. Josh
    Josh avatar
    47 posts
    Registered:
    01 Jun 2018
    Answered
    20 Jul 2020 in reply to Dmitriy Razumov_2
    Link to this post
    Hello Dmitriy,

    Below is some sample code on how you can access the language mappings inside The Portal Connector Configuration.

    //Acquire Language Mappings from Configuration
    ConfigElementDictionary<string, LanguageMappingElement> languageMappings = Config.Get<PortalConnectorConfig>().LanguageMappings;
    
    //Loop Through Language Mappings
    foreach (string key in languageMappings.Keys)
    {
       LanguageMappingElement languageMapping = languageMappings[key];
       string fromLanguageCode = languageMapping.FromLanguageCode;
       string toLanguageCode = languageMapping.ToLanguageCode;
    }
    

    Please let me know if you still have any questions.

    Cheers,

    Josh
  3. Dmitriy Razumov_2
    Dmitriy Razumov_2 avatar
    31 posts
    Registered:
    20 Jul 2020
    21 Jul 2020 in reply to Josh
    Link to this post
    Hello Josh.

    Thank you very much, I will try to run it.
  4. Dmitriy Razumov_2
    Dmitriy Razumov_2 avatar
    31 posts
    Registered:
    20 Jul 2020
    22 Jul 2020 in reply to Josh
    Link to this post
    Working great, thank you very much!
4 posts, 1 answered