locked
How to add resource files to project correctly on Visual Studio 2017 IDE? RRS feed

  • Question

  • Dear All,

    When multilingual languages are implemented, the resources files help.

    When two resources files are added to project

    Add->New Item -> Resource1.resx and Add->New Item -> Resource1.zh-Hant.resx

    It looks like below

    My question is why there is a Resource1.Designer.cs generated?

    Is this file could be deleted?

    Or there is a correct way to add resource files?

    Thanks and Best regards,

    E-John




    • Edited by E-John Thursday, October 24, 2019 6:44 AM
    Thursday, October 24, 2019 6:42 AM

All replies

  • Hi E-John,

    Welcome to the MSDN forum.

    Your steps are absolutely right. The Designer.cs file automatically generates the code based on the field you added in default resource file with the suffix resx, so you can reference this parameter during development. However, this file is not generated for resource files in other languages. Only resource.resx is embedded in the main program. It is by design. What happened to you is normal.

    Resource1.zh-Hant.resx actually depend on resource.resx.

    These files are only consistent with the fields in the default resource. resx, but the value is translated into their respective languages.

    You can refer to this document for the language identifier of the resource file.

    About how to use you can refer to this document:http://www.thebestcsharpprogrammerintheworld.com/2017/07/26/localizing-a-wpf-program-using-c/

    Best Regards,

    Perry


    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, October 25, 2019 7:14 AM
  • Hi E-John,

    Did your issue still persist? If you still have any concern, please feel free to let us know so that we can offer you better support.

    If the reply is helpful you, do not forget to mark is as answer.

    Look forward to hearing from you.

    Best Regards,

    Perry


    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, October 28, 2019 9:59 AM
  • Hi E-John,

    Sorry for bothering you.

    The Designer.cs is generated by "ResXFileCodeGenerator" tool. It is used to edit resx file programmatically. You could delete this tool in Custom Tool, then the Designer.cs file will be deleted.

    Hope it could help you.

    Best Regards,

    Dylan


    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

    Wednesday, October 30, 2019 8:15 AM