plural2R: plural2R

Description Usage Arguments Value Examples

View source: R/plural2R.R

Description

Converts a plural from from text to list with the input text, nplurals value and a R function plural(n) which computes the plural index from n.

Usage

1
plural2R(ctxt)

Arguments

ctxt

character: one string with a plural form

Value

list with the input text, nplurals value and a R function plural(n)

Examples

1
2
3
4
5
6
# Belarusian plural form
p <- paste0('nplurals=3;',
     'plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);')
l <- plural2R(p)
l$nplurals
l$plural(0:100)

sigbertklinke/gettext documentation built on Feb. 17, 2020, 10:37 a.m.