如何在 xamarin.android 应用中编辑 BundleConfig.json

How edit BundleConfig.json in xamarin.android app

我正在使用 Visual Studio 2022 编写 Xamarin.Android 应用程序。不幸的是,新应用程序需要 .abb 包。这是在应用程序中更改语言的问题开始的地方。我正在使用 ContextWrapper 来更改语言。我已经阅读了该语言在应用程序中正常工作的内容,我必须将此代码添加到 BundleConfig.json 文件中:

android {
bundle {
    language {
    // Specifies that the app bundle should not support
    // configuration APKs for language resources. These
    // resources are instead packaged with each base and
    // dynamic feature APK.
    enableSplit = false
    }
   }
  }

不幸的是,我在 Internet 上找不到如何编辑此文件以及在哪里可以找到它。请帮忙。

您可以使用内置的 .NET 本地化框架在您的应用程序中设置语言, 本地化 .NET 应用程序的内置机制使用 RESX 文件和 System.Resources 和 System.Globalization 命名空间中的 classes。包含已翻译字符串的 RESX 文件与编译器生成的 class 一起嵌入到 Xamarin.Forms 程序集中,后者提供对翻译的强类型访问。然后可以在代码中检索翻译后的文本。

可以参考这个文档:https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/localization/text?pivots=windows