1.0.1 • Published 3 years ago

paparsya v1.0.1

Weekly downloads
1
License
ISC
Repository
-
Last release
3 years ago

paparsya

WIP

Parse localized strings

let text = "Simeple text with a {variable}!"

paparsya(text, { variable: 'Whatnot' })
let text = "{comp:count, 1 {{count} User}, default {{count} Users}}"

paparsya(text, { count: 3 })

Rules

{variable}

{function:, }

Functions

Comp

Compare: {comp:, {}, {}, default {}}

Examples {comp:number, 1 {Number is one!}, default {Number is: {number}}} {comp:region, eu {Europe!}, us {US!}, default {Other}}

Plural

Plural: {plural:count, one {}, zero {}, other {}}

Example: {plural:count, one {{count} User}, other {{count} Users}}