Skip to content

Commit

Permalink
Improve i18n types
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Dec 11, 2019
1 parent 7e19324 commit ae3bb21
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions packages/i18n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ _Related_

_Parameters_

- _data_ `?Object`: Locale data configuration.
- _domain_ `?string`: Domain for which configuration applies.
- _data_ `[Object]`: Locale data configuration.
- _domain_ `[string]`: Domain for which configuration applies.

<a name="sprintf" href="#sprintf">#</a> **sprintf**

Expand Down Expand Up @@ -73,7 +73,7 @@ _Parameters_
- _single_ `string`: The text to be used if the number is singular.
- _plural_ `string`: The text to be used if the number is plural.
- _number_ `number`: The number to compare against to use either the singular or plural form.
- _domain_ `?string`: Domain to retrieve the translated text.
- _domain_ `[string]`: Domain to retrieve the translated text.

_Returns_

Expand All @@ -94,7 +94,7 @@ _Parameters_
- _plural_ `string`: The text to be used if the number is plural.
- _number_ `number`: The number to compare against to use either the singular or plural form.
- _context_ `string`: Context information for the translators.
- _domain_ `?string`: Domain to retrieve the translated text.
- _domain_ `[string]`: Domain to retrieve the translated text.

_Returns_

Expand All @@ -112,7 +112,7 @@ _Parameters_

- _text_ `string`: Text to translate.
- _context_ `string`: Context information for the translators.
- _domain_ `?string`: Domain to retrieve the translated text.
- _domain_ `[string]`: Domain to retrieve the translated text.

_Returns_

Expand All @@ -129,7 +129,7 @@ _Related_
_Parameters_

- _text_ `string`: Text to translate.
- _domain_ `?string`: Domain to retrieve the translated text.
- _domain_ `[string]`: Domain to retrieve the translated text.

_Returns_

Expand Down
28 changes: 14 additions & 14 deletions packages/i18n/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const i18n = new Tannin( {} );
*
* @see http://messageformat.github.io/Jed/
*
* @param {?Object} data Locale data configuration.
* @param {?string} domain Domain for which configuration applies.
* @param {Object} [data] Locale data configuration.
* @param {string} [domain] Domain for which configuration applies.
*/
export function setLocaleData( data, domain = 'default' ) {
i18n.data[ domain ] = {
Expand All @@ -61,12 +61,12 @@ export function setLocaleData( data, domain = 'default' ) {
* Wrapper for Tannin's `dcnpgettext`. Populates default locale data if not
* otherwise previously assigned.
*
* @param {?string} domain Domain to retrieve the translated text.
* @param {?string} context Context information for the translators.
* @param {string|undefined} domain Domain to retrieve the translated text.
* @param {string|undefined} context Context information for the translators.
* @param {string} single Text to translate if non-plural. Used as fallback
* return value on a caught error.
* @param {?string} plural The text to be used if the number is plural.
* @param {?number} number The number to compare against to use either the
* @param {string} [plural] The text to be used if the number is plural.
* @param {number} [number] The number to compare against to use either the
* singular or plural form.
*
* @return {string} The translated string.
Expand All @@ -85,7 +85,7 @@ function dcnpgettext( domain = 'default', context, single, plural, number ) {
* @see https://developer.wordpress.org/reference/functions/__/
*
* @param {string} text Text to translate.
* @param {?string} domain Domain to retrieve the translated text.
* @param {string} [domain] Domain to retrieve the translated text.
*
* @return {string} Translated text.
*/
Expand All @@ -100,7 +100,7 @@ export function __( text, domain ) {
*
* @param {string} text Text to translate.
* @param {string} context Context information for the translators.
* @param {?string} domain Domain to retrieve the translated text.
* @param {string} [domain] Domain to retrieve the translated text.
*
* @return {string} Translated context string without pipe.
*/
Expand All @@ -114,11 +114,11 @@ export function _x( text, context, domain ) {
*
* @see https://developer.wordpress.org/reference/functions/_n/
*
* @param {string} single The text to be used if the number is singular.
* @param {string} plural The text to be used if the number is plural.
* @param {number} number The number to compare against to use either the
* singular or plural form.
* @param {?string} domain Domain to retrieve the translated text.
* @param {string} single The text to be used if the number is singular.
* @param {string} plural The text to be used if the number is plural.
* @param {number} number The number to compare against to use either the
* singular or plural form.
* @param {string} [domain] Domain to retrieve the translated text.
*
* @return {string} The translated singular or plural form.
*/
Expand All @@ -137,7 +137,7 @@ export function _n( single, plural, number, domain ) {
* @param {number} number The number to compare against to use either the
* singular or plural form.
* @param {string} context Context information for the translators.
* @param {?string} domain Domain to retrieve the translated text.
* @param {string} [domain] Domain to retrieve the translated text.
*
* @return {string} The translated singular or plural form.
*/
Expand Down

0 comments on commit ae3bb21

Please sign in to comment.