generate_po_from_pot: Generate a PO object from a POT object

Description Usage Arguments Details Value Note Examples

View source: R/generate_po_from_pot.R

Description

Generates a PO object from a POT object.

Usage

1
2
3
4
generate_po_from_pot(x, lang, ...)

## S3 method for class 'po'
generate_po_from_pot(x, lang, ...)

Arguments

x

An object of class po, as read by read_po from a POT file.

lang

A language code, possibly with a country code attached. See language_codes for possible values.

...

Currently unused.

Details

The file_type element is changed from "pot" to "po", and "Language" and "Plural-Forms" values are added to the metadata element.

Value

An object of class po, ready to be written to a PO file by write_po.

Note

If the plural form is unknown for the specified language, the plural form is set to NA. See plural_forms for supported languages.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
pot_file <- system.file("extdata/R-summerof69.pot", package = "poio")
pot <- read_po(pot_file)
# It's a good idea to fix the metadata before you generate the PO files
pot_fixed <- fix_metadata(pot, system.file(package = "poio"))

# Call generate_po_from_pot for each language that you want to translate to
two_pos <- lapply(
  c(German = "de", Qatari_Arabic = "ar_QA"),
  generate_po_from_pot,
  x = pot_fixed
)

# Notice the Language and Plural-forms elements in the metadata
two_pos$German$metadata
# Also notice that the countable msgstr elements for Arabic now
# have length 6, since Arabic has 6 plural forms
two_pos$Qatari_Arabic$countable$msgstr

poio documentation built on April 19, 2020, 4:16 p.m.