none
How can I use Reflection to get all the strings wrapped in localizer in startup? RRS feed

  • Question

  • I'm following the docs for localization and I read "You can leave the default language literal strings in the app and wrap them in the localizer, so that you can focus on developing the app. "
    How can I get all strings wrapped with localizer and save them to a database table?
    Is it possible to do it using Reflection. Can you please guide me with an example?

    I already did it for data annotations using reflection, but I can't find a way to do it for the wrapped with localizer strings.

    Thursday, November 7, 2019 10:54 PM

All replies

  • Hi Stelios M,

    Thank you for posting here.

    I note that the document you mentioned is Globalization and localization in ASP.NET Core which related to ASP.NET Core.

    I have a question to confirm with you.

    What's the type of your application? ASP.NET Core?

    We are waiting for your update.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, November 8, 2019 8:16 AM
  • Hi Xingyu Zhao

    Thank you for responding!

    I'm developing a web application using ASP.NET Core 3.0 and I'm in the process of Localization.

    I do not use resx files for this. Instead I'm using an MSSQL database and EF to localize it.
    I'm trying very hard to find a way to get all these literal strings from the assemblies but with no success.

    I already localized Data Attributes using Reflection and I can't find the way to do it for the rest of the strings.

    Can you please advice with some suggestions?


    • Edited by Stelios M Friday, November 8, 2019 1:17 PM
    Friday, November 8, 2019 9:16 AM
  • Hi Xingyu Zhao

    Thank you for responding!

    I'm developing a web application using ASP.NET Core 3.0 and I'm in the process of Localization.

    I do not use resx files for this. Instead I'm using an MSSQL database and EF to localize it.
    I'm trying very hard to find a way to get all these literal strings from the assemblies but with no success.

    I already localized Data Attributes using Reflection and I can't find the way to do it for the rest of the strings.

    Can you please advice with some suggestions?

    Sunday, November 10, 2019 6:37 PM
  • Hi Stelios M,

    Thanks for your feedback.

    According to your description, your issue is more related to ASP.NET Core. Therefore, it will be more appropriate to ask your question in ASP.NET Core Forum
    The C# forum is for C# related question, we discuss and ask the C# programming language, IDE, libraries, samples and tools here. 

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 11, 2019 1:52 AM