在一个Humanizer.Core应用程序中,我从核心(.Net标准项目)调用了人机界面,我使用Nuget的Xamarin.Forms和Humanizer.Core.ru软件包,并将其命名为
DateTime.UtcNow.AddMinutes(-3).Humanize(culture:新CultureInfo(“Ru-Ru”);
我总是在3分钟前学会英语
我试过申请:
CultureInfo ci = new CultureInfo("ru-Ru");
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;而这些并没有影响到我的结果,我又获得了英语。
发布于 2021-02-26 14:21:45
我用解决办法解决了这个问题。
从Nuget packages.
中。

在这些dll的. yourProject.csproj 上添加对PCL项目
<ItemGroup>
.......
<Reference Include="Humanizer.Core">
<HintPath>..\..\CommonResources\Humanizer\Humanizer.dll</HintPath>
</Reference>
<Reference Include="Humanizer.Core.ru">
<HintPath>..\..\CommonResources\Humanizer\ru\Humanizer.resources.dll</HintPath>
</Reference>
.......
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2012" />
</ItemGroup>

在添加dll文件之后,我在项目中得到了本地化文本。

发布于 2022-01-07 15:42:22
Thx @polyariz,我可以确认这仍然适用于.NET MAUI,只需将.dlls复制到参考资料文件夹.

并通过右键单击依赖项和“添加项目引用.”将它们添加到项目中。

https://stackoverflow.com/questions/66387512
复制相似问题