Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I started working on context function pgettext #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

buma
Copy link

@buma buma commented Jun 24, 2015

I needed context support so I added it. Since library supports everything else.

My addition is a little hackish IMHO I added third item in list which is returned from getTranslatable. So normal gettext returns item, plural returns 2 item array, context 3 item. First item is key second is context.

Any suggestions for improvement are welcome. I'm not at home in Javascript I think I changed all the necessary code. I'll add some handlebar tests.

Working on #94.
Extracting works. I also added tests. I updated same tests that adding ngettext changed.

Joining works if I parse both files (they are correctly deduplicated). But If I join with existing messages.pot like join test is doing they are joined incorrectly.

In addition to correctly joined msgid there is another from the second file

Working on zaach#94.
Extracting works. But joining joins incorrectly. If I parse both files
they are joined correctly.
} else {
translations[str].msgid_plural = extractStr(arg[1]);
translations[str].msgstr = ['', ''];
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wont work well, since it makes impossible to use plurals with context and all other future combinations.

Though, I must say that to make it work original section must be refactored too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is for function getTranslatable to return object instead of array. And in object you would have context, singular, plural, domain keys values would be the same objects that are in array. That way you can have context with plurals and other combinations. IMHO.

@buma buma mentioned this pull request Jul 28, 2015
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants