Giter Club home page Giter Club logo

vernacular's Introduction

Vernacular

Vernacular is a localization tool for developers. It currently is focused on providing a unified localization system for MonoTouch, Mono for Android, and Windows Phone.

Vernacular consists of two primary components:

  • a tool for extracting strings and generating resource files
  • a small library that applications can use to read localized strings

Why?

At Rdio, our mobile applications share a common C#/.NET core, but we ran into countless problems with sharing localized strings across the applications. We developed Vernacular to solve this problem.

Localization support is fairly poor and inconsistent across the dominant mobile phone platforms. For instance, Android and Windows Phone make localization a huge chore with generated code, naming of resources, and converters, and iPhone doesn't support plurals (providing only NSLocalizedString(message)).

Vernacular solves this by providing a gettext-inspired API for localizing strings directly within application code. It supports plurals and even genders.

Not Complete

While Vernacular is currently very useful, it is still under development. There are certainly some bugs, and this documentation is nowhere near complete.

License

Vernacular is licensed under the MIT X11 license. Copyright 2012 Rdio, Inc.

vernacular's People

Contributors

abock avatar bduncavage avatar benjamin-bader avatar dustin-graham avatar johansson avatar mharju avatar mightea avatar roosmaa avatar rubenv avatar seans23 avatar stephanedelcroix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vernacular's Issues

String Consistency

Hello,

What is the recommended strategy to centralize and unify the resources? If you have an iOS and Android apps and there is one developer on each of them how do they keep consistent the strings they are using?

Thanks!
R.

android-input-strings-xml ignores the translations

If you use --android-input-strings-xml it is supposed to add the list of nonlocalized strings to the localized strings.
You end up with just a copy of your nonlocalized strings.
I'm not exactly sure how the for loop in LoxalizedManualStringXml is supposed to work (is it trying to see if the nonlocalized string is in the localized list?)
but I just added the code in Generate to the end of the WriteDocument statement.

                foreach (var resource_string in GetAllResourceStrings())
                {
                    WriteString(parent, resource_string.Id, resource_string.Translated);
                }

Now, at least for me, it doesn't what it should do.

Support specific field assignment extraction

I'm considering Vernacular to add localization support to our (Winforms) solution.
Using Catalog.get* is easy enough, but I'm wondering if it could be further simplified for developpers, by automagically extracting some fields assignments.

For instance every assignment to Control::Text property to a string constant could be extracted.
Further down we could extract all string properties which have the attribute [Localizable(true)] (like the VS designer is doing when enabling Localizable).

If I write control.Text = "Foo", processing the assembly through Vernacular would also replace this by control.Text = Catalog.getString("Foo").

Any thoughts on this ?

Getting no translations back.

I have installed vernacular using make; make install, brought the dlls over to my xamarin project and wrote this small script.

Inside my code file is this line.
string a = Catalog.GetString ("teststring", "testcomment");

vernacular
--output=em.pot
--input=Debug/EMXamarin.dll
--source-root=$EMCLIENTROOT/etc/etc
--generator=po
--pot
--meta="Project-Id-Version=EM PROJECT"
--meta="Project-Creation-Date=$(date '+%Y-%m-%d %H:$M%z')"
--log
--verbose
--analyze

I end up getting this back.

msgid ""
msgstr ""
"Project-Id-Version: EM PROJECT\n"
"Project-Creation-Date: 2014-03-28 11:$M-0700\n"
"PO-Revision-Date: 2014-03-28 11:31-07\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Vernacular"

IL parser should detect non-constant strings (ldstr) passed to Get*String calls

The IL parser can extract false-positives if the Catalog.Get*String APIs are misused. To avoid this, and to warn of improper usage of the API, the IL parser should warn if non-constants are passed to the APIs.

Example:

void Foo()
{
    var x = "Foo";
    DoSomething("Hello");
    Catalog.GetString(x);
}

Vernacular may actually extract the constant ldstr "Hello" instruction that is an argument for DoSomething because x (a non-constant load) is passed to GetString.

Fixing this addresses two issues:

  • no false-positive string extractions due to possible "bleeding" of ldstr instructions
  • catch improper usage of the API where non-constants are being passed (and thus not possible to extract)

`make install` depends on `make vernacular`

Hey,

I just checked this project out and executed make install. It gave me errors:

$ make install
mkdir -p "/usr/local/lib/vernacular"
mkdir -p "/usr/local/bin"
for file in Mono.Cecil.dll Mono.Cecil.Mdb.dll Mono.Cecil.Pdb.dll Vernacular.Catalog.dll Vernacular.Catalog.dll.mdb Vernacular.Potato.dll Vernacular.Potato.dll.mdb Vernacular.exe Vernacular.exe.mdb; do \
        install -m 0755 "Vernacular.Tool/bin/Debug/$file" "/usr/local/lib/vernacular"; \
    done
install: Vernacular.Tool/bin/Debug/Mono.Cecil.dll: No such file or directory
install: Vernacular.Tool/bin/Debug/Mono.Cecil.Mdb.dll: No such file or directory
install: Vernacular.Tool/bin/Debug/Mono.Cecil.Pdb.dll: No such file or directory
install: Vernacular.Tool/bin/Debug/Vernacular.Catalog.dll: No such file or directory
install: Vernacular.Tool/bin/Debug/Vernacular.Catalog.dll.mdb: No such file or directory
install: Vernacular.Tool/bin/Debug/Vernacular.Potato.dll: No such file or directory
install: Vernacular.Tool/bin/Debug/Vernacular.Potato.dll.mdb: No such file or directory
install: Vernacular.Tool/bin/Debug/Vernacular.exe: No such file or directory
install: Vernacular.Tool/bin/Debug/Vernacular.exe.mdb: No such file or directory
make: *** [install] Error 71

First executing make (which is basically make vernacular) and then executing make install made everything work as expected.

Maybe make install should depend on make vernacular in the Makefile?

Usage from a MT project is difficult/error prone

So, we are using Vernacular.Catalog inside a MT project, and having lots of weird issues.

We are using MT alpha (so 7.0), and we often have to completely rebuild the binary in order to have it run on the device properly, as it is building against the 4.0 framework.

I tried including Vernacular.Catalog.csproj in our solution, but I am unable to due to the target framework again.

What is the right way to do this?

Arabic (.ar) translation doesn't work

We have used vernacular for other language translations successfully, but if we try to use arabic, we just get the untranslated terms back. I've tried to use another language's strings as well for the arabic version just to test whether it is the arabic text itself that's messing with us, but even if I use any latin language for the .ar version, it still doesn't work.

EDIT:
Interestingly enough, if I copied the Arabic text itself for another language (let's say Spanish resources), I will see the Arabic translation in the app. Somehow it seems like the Arabic flag is ignored in the project when it comes to recognising available languages?

Both for iOS (ar.lproj) and Android (values-ar).

Exception: Unknown custom metadata item kind: 7

Hi,

I'm receiving this exception lately. I was able to run Vernacular and already have some translations. After recent changes in my code it throws this error now. Any ideas?

Unhandled Exception: Microsoft.Cci.Pdb.PdbDebugException: Unknown custom metadata item kind: 7 at Microsoft.Cci.Pdb.PdbFunction.ReadCustomMetadata(BitAccess bits) at Microsoft.Cci.Pdb.PdbFunction..ctor(ManProcSym proc, BitAccess bits) at Microsoft.Cci.Pdb.PdbFunction.LoadManagedFunctions(BitAccess bits, UInt32 limit, Boolean readStrings) at Microsoft.Cci.Pdb.PdbFile.LoadFuncsFromDbiModule(BitAccess bits, DbiModule Info info, IntHashTable names, ArrayList funcList, Boolean readStrings, MsfDirectory dir, Dictionary2 nameIndex, PdbReader reader) at Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read, BitAccess bits, Boolean readAllStrings, Int32& age, Guid& guid) at Mono.Cecil.Pdb.PdbReader.PopulateFunctions() at Mono.Cecil.Pdb.PdbReader.ProcessDebugHeader(ImageDebugDirectory directory, Byte[] header) at Mono.Cecil.ModuleDefinition.ProcessDebugHeader() at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader) at Mono.Cecil.ModuleDefinition.ReadSymbols() at Vernacular.Parsers.AssemblyParser.Add(ModuleDefinition module) at Vernacular.Parsers.AssemblyParser.Add(String path) at Vernacular.Parsers.AggregateParser.Add(String path) at Vernacular.Tool.Entry.Main(String[] args)

I am using VS2013 Update 2. I am getting error while compiling

Hi,

As is pull from github was giving lot of errors (37 errors and 16 warnings) first one being 'Vernacular.Generators.Generator.ResourceIdType' is a 'property' but is used like a 'type' GitHub\vernacular\Vernacular.Tool\Vernacular.Generators\ResxGenerator.cs 35 28 Vernacular.Tool

When I tried copying all the files from Vernacular.Catalog to Vernacular.Tool project, I am getting following error..

Error 15 'System.Type' does not contain a definition for 'GetTypeInfo' and no extension method 'GetTypeInfo' accepting a first argument of type 'System.Type' could be found (are you missing a using directive or an assembly reference?) GitHub\vernacular\Vernacular.Tool\Vernacular\FieldReflectionResourceCatalog.cs 90 41 Vernacular.Tool

Can you let me know how to fix these issues. Reflection is somehow not working

Future of Vernacular?

With Rdio no longer a going concern, this repository doesn't seem to be a safe or durable home for Vernacular. Does it make sense (given the asset sale to Pandora) for Pandora to assume ownership? Or would it make sense for a more active user/contributor to take over? (And here I must explicitly disclaim any interest).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.