Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Vernacular on the PCL code

$
0
0

Hi there,

I'm using Vernacular to localize my cross-platform app but some strings are located on my PCL project. I've found how to initiate the catalog on iOS and Android but I don't know how to do it on the PCL (if that's needed).

This is the iOS code on AppDelegate:

Catalog.Implementation = new ResourceCatalog {
    GetResourceById = id =>  {
        var resource = NSBundle.MainBundle.LocalizedString(id, null);
        return resource ==  id ? null : resource;
    },
};

If I try to use Catalog.GetString() on the iOS code, it work fine. If I use it on the PCL code it throws me an ArgumentOutOfRange exception on Vernacular GetResourceId method.

The code that calls Catalog.GetString on my PCL runs after the catalog implementation on iOS.

What am I doing wrong?

Thank you


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>