我使用MvvmCross Resx Localization插件。这适用于我所有的布局。但所有的菜单都是未翻译的。我有这个xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto">
<group android:id="@+id/nav_items">
<item
android:id="@+id/nav_accounts"
android:icon="@drawable/ic_account_balance"
local:MvxLang="Text AccountsLabel" />
<item
android:id="@+id/nav_statistics"
android:icon="@drawable/ic_show_chart"
local:MvxLang="Text StatisticsLabel" />
</group>
<group android:id="@+id/nav_footer">
<item
android:id="@+id/nav_categories"
android:icon="@drawable/ic_label_outline"
local:MvxLang="Text CategoriesLabel" />
<item
android:id="@+id/nav_backup"
android:icon="@drawable/ic_backup"
local:MvxLang="Text BackupLabel" />
<item
android:id="@+id/nav_settings"
android:icon="@drawable/ic_settings"
local:MvxLang="Text BackupLabel" />
<item
android:id="@+id/nav_about"
android:icon="@drawable/ic_info"
local:MvxLang="Text AboutLabel" />
</group>
</menu>
我把它包括在这里:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.NavigationView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.Menu"
local:headerLayout="@layout/fragment_navigation_header"
local:menu="@menu/navigation_drawer" />
我还有一个带有TextSource定义的viewmodel:
public IMvxLanguageBinder TextSource => new MvxLanguageBinder("", GetType().Name);
我制作了一个构造函数并解析了我想要的标签。例如&#34; AboutLabel&#34;。这没有任何问题。 是否有修复菜单的效果?