_n
Translates a plural message.
info
Shorthand for L10n._n.
Signature
_n(message: string, messagePlural: string, count: number, ...arguments: string[]): string
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
message | string | No | Specifies the message to translate. |
messagePlural | string | No | Specifies the plural message to translate. |
count | number | No | Specifies the count for the plural (can be reference in the message with %1). |
arguments | string[] | Yes | Optional string arguments which can be referenced in the message using the percent sign followed by the argument index %n. The count value is automatically included as the first argument (%1). |
Return value
Returns the translated message.
Example
import { _n } from "@tripetto/builder";
// Outputs `1 car` to the console.
console.log(_n("1 car", "%1 cars", 1));
// Outputs `2 cars` to the console.
console.log(_n("1 car", "%1 cars", 2));