jsxgettext icon indicating copy to clipboard operation
jsxgettext copied to clipboard

Domain and context function

Open ArmorDarks opened this issue 10 years ago • 1 comments

It's great that plurals were finally implemented.

I believe there left only one crucial piece, without which most projects will suffer: domain or context.

Those are:

// domain
dgettext    = function ( domain, key )
dngettext   = function ( domain, singular_ley, plural_key, value )

// or context
pgettext    = function ( context, key )
npgettext   = function ( context, singular_key, plural_key, value )

// or both
dpgettext   = function ( domain, context, key )
dnpgettext  = function ( domain, context, singular_key, plural_key, value )

// or with category
dcgettext   = function ( domain, key, category )
dcngettext  = function ( domain, singular_key, plural_key, value, category )
dcnpgettext = function ( domain, context, singular_key, plural_key, value, category )

I'm not sure about category. Don't remember I've seen it used somewhere, since usually it's enough to have just context.

Domains (which are, in fact, language codes) aren't interesting for us during extraction, but crucial for output. So, in case of domain jsxgettext should be able to simply skip it.

So, I'd say, it's crucial to have at least context and domains, since without domains it's impossible for devs to load string from specific domain, and without context it's impossible to implement context-aware strings and feminine forms.

Edited: sorry, there were error in domains description. I always forgetting that they are in fact languages, into which string should be outputted)

ArmorDarks avatar Jun 18 '15 08:06 ArmorDarks

Just for the note, there seems to be no sense to implement categories, since it's almost unused and most gettext-outputting libraries will simple ignore it.

ArmorDarks avatar Oct 16 '15 05:10 ArmorDarks