xamarin.formslocalizationhumanizer

Humanizer Localization Issue in Xamarin Forms


In a Xamarin.Forms app, I calling Humanizer from the Core (.Net Standard project) I'm using the Nugets Humanizer.Core and Humanizer.Core.ru package for Russian And calling it
DateTime.UtcNow.AddMinutes(-3).Humanize(culture: new CultureInfo("ru-Ru"));

And always I get english like 3 minutes ago

I tried apply:

CultureInfo ci = new CultureInfo("ru-Ru"); 
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;

And these not infleunt on a result, I get again english.


Solution

  • I resolved the issue with the workaround.

    1. I removed from Nuget all Humanize packages.
    2. Follow to the packages directory: C:\Users\USERNAME\.nuget\packages
    3. Need to copy files Humanize dll's from next's folders:
    1. Into my project folder I created CommonResources folder. Then I created Humanize folder into CommonResources and pasted 2 files and "ru" folder to my Humanize.

    enter image description here

    1. Add references to PCL project yourProject.csproj file on these dll's.
      <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> 
    

    enter image description here

    After the dll files were added I got localized text into my project.

    enter image description here