Using Vernacular

rrodriguezrrodriguez USMember
edited September 2013 in Cross Platform with Xamarin

Hello,

I'm starting a project that contains an iOS and Android apps. These apps should be properly localized and we have chosen Vernacular to achieve this localization.

General question:

1) Is there any other cross-platform method/framework out there? I had been playing around with Vernacular for less than a day, and even when it seems cool and promises to work fine, it lacks documentation and examples out there.

Vernacular specific:

1) How do you add vernacular to your project? I'm working on the iOS portion and -after compiling vernacular solution- I could add Vernacular.Catalog.dll as a reference to both my Core and iOS applications. Is this the right way to do it? I would love to see a vernacular component.

2) Can I run vernacular in a mac? I haven't found how (I'm a newbie mac user). I could run it on my pc only.

Thanks,
R.

Posts

  • DanBelcherDanBelcher USMember ✭✭

    Rasiel-

    Re: your Vernacular specific questions...

    1) Yes, you simply add the .NET Vernacular.Catalog.dll as a Reference in your project. Ofcourse, you'll need to make sure that you are
    using Vernacular;
    in the project. You will then need to call the platform-specific catalog implementation:

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

    For iOS, this will likely happen the the FinishedLaunching method of your AppDelegate. Now you can call Vernacular.Catalog.GetString("YourString", "YourComment");

    2) I'm running Vernacular on Mac OS X without issue. You'll need to rename Vernacular.exe to vernacular and make sure you have proper permissions to run it (sudo chmod a+x vernacular). You will likely also want to add it your .bash_profile PATH and write shell scripts or msbuild scripts to automate the process, but it works great when you get things setup.

  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭

    I'm using localization in the PCL project using .resx files. I've been working this way several months and it's pretty easy and completely cross-platform. One single localization file for all the platforms.

    Check out this tutorial for more info. I've tweaked this solution a little, but it worked out of the box pretty well.

  • rrodriguezrrodriguez USMember

    @danb thanks for your response. I ended up using Vernacular and I forgot to post the results back here (my bad, somehow this thread was never replied and I forgot about it).

  • rrodriguezrrodriguez USMember
    edited December 2013

    @GuillermoGutierrez I remember seeing the satellite assembly support but I gave it a tried and never made it to work. (Never found pointers as the blog post you included here though).

    I have a 2 level PCL in my app, one PCL which is used not only by my mobile apps, but also by the web app, in that PCL I put .resx resources I intended to use everywhere, however I could never use them in iOS. I will give it another try.

    While investigating on Vernacular, I learned that .resx are very limited, things like gender and plurals are not supported naturally.

    It is not fun to have 2 sets of resources, and a lot of duplicates as I have now between my .resx and Vernacular, but I haven't found the time to clean this mess as focused as I'm in new features.

Sign In or Register to comment.