Code Duplication    Length = 17-18 lines in 2 locations

wp-includes/l10n.php 2 locations

@@ 332-348 (lines=17) @@
329
 *                       Default 'default'.
330
 * @return string The translated singular or plural form.
331
 */
332
function _n( $single, $plural, $number, $domain = 'default' ) {
333
	$translations = get_translations_for_domain( $domain );
334
	$translation = $translations->translate_plural( $single, $plural, $number );
335
336
	/**
337
	 * Filters the singular or plural form of a string.
338
	 *
339
	 * @since 2.2.0
340
	 *
341
	 * @param string $translation Translated text.
342
	 * @param string $single      The text to be used if the number is singular.
343
	 * @param string $plural      The text to be used if the number is plural.
344
	 * @param string $number      The number to compare against to use either the singular or plural form.
345
	 * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
346
	 */
347
	return apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );
348
}
349
350
/**
351
 * Translates and retrieves the singular or plural form based on the supplied number, with gettext context.
@@ 372-389 (lines=18) @@
369
 *                        Default 'default'.
370
 * @return string The translated singular or plural form.
371
 */
372
function _nx($single, $plural, $number, $context, $domain = 'default') {
373
	$translations = get_translations_for_domain( $domain );
374
	$translation = $translations->translate_plural( $single, $plural, $number, $context );
375
376
	/**
377
	 * Filters the singular or plural form of a string with gettext context.
378
	 *
379
	 * @since 2.8.0
380
	 *
381
	 * @param string $translation Translated text.
382
	 * @param string $single      The text to be used if the number is singular.
383
	 * @param string $plural      The text to be used if the number is plural.
384
	 * @param string $number      The number to compare against to use either the singular or plural form.
385
	 * @param string $context     Context information for the translators.
386
	 * @param string $domain      Text domain. Unique identifier for retrieving translated strings.
387
	 */
388
	return apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, $domain );
389
}
390
391
/**
392
 * Registers plural strings in POT file, but does not translate them.