【问题标题】:How edit BundleConfig.json in xamarin.android app如何在 xamarin.android 应用程序中编辑 BundleConfig.json
【发布时间】:2022-01-04 20:36:24
【问题描述】:

我正在使用 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
    }
   }
  }

不幸的是,我在互联网上没有找到如何编辑这个文件以及在哪里可以找到它。请帮忙。

【问题讨论】:

    标签: c# android xamarin visual-studio-2022


    【解决方案1】:

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

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

    【讨论】:

    • 我已经在 UWP 中遇到过 resx 文件。我认为它们不适用于 Xamarin.Android 应用程序。我还有一个问题。 AppResources.resx 是必须放在区域的 values 目录中还是只需要放在 Resources 目录中?
    猜你喜欢
    • 1970-01-01
    • 2012-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-14
    • 1970-01-01
    • 2021-05-30
    • 1970-01-01
    相关资源
    最近更新 更多