Learn R Programming

poio (version 0.0-4)

generate_po_from_pot: Generate a PO object from a POT object

Description

Generates a PO object from a POT object.

Usage

generate_po_from_pot(x, lang, ...)

# S3 method for 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.

Value

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

Details

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

Examples

Run this code
# NOT RUN {
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
# }

Run the code above in your browser using DataLab