/**
         * Retrieves the plural translation for msgid1.
         *
         * @param env
         * @param domain
         * @param category
         * @param msgid1
         * @param msgid2
         *
         * @return translation found, else msgid1 if n == 1, else msgid2
         */
        private StringValue translate(Env env,
                                      GettextDomain domain,
                                      CharSequence category,
                                      StringValue msgid1,
                                      StringValue msgid2,
                                      int quantity,
                                      Value [] args)
        {
            Locale locale = env.getLocaleInfo().getMessages().getLocale();

            GettextResource resource = getResource(env,
                                                   domain.getPath(),
                                                   locale,
                                                   category,
                                                   domain.getName());

            StringValue unicodeTranslation
                = resource.getTranslation(msgid1, quantity);

            if (unicodeTranslation == null)
            {
                unicodeTranslation = errorReturn(msgid1, msgid2, quantity);
            }

            StringValue translation = msgid1.create(
                env, unicodeTranslation, domain.getCharset());

            return(format(env, translation, args));
        }
        private GettextResource getResource(Env env,
                                            string path,
                                            Locale locale,
                                            CharSequence category,
                                            string domain)
        {
            ArrayList <Object> key = new ArrayList <Object>();

            key.add(path.getFullPath());
            key.add(locale);
            key.add(category);
            key.add(domain);

            GettextResource resource = _cache.get(key);

            if (resource == null)
            {
                resource = new GettextResource(env, path, locale, category, domain);
                _cache.put(key, resource);
            }

            return(resource);
        }