略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: dcgettext

2024-12-21

dcgettext

(PHP 4, PHP 5, PHP 7, PHP 8)

dcgettextOverrides the domain for a single lookup

说明

dcgettext(string $domain, string $message, int $category): string

This function allows you to override the current domain for a single message lookup.

参数

domain

The domain

message

The message

category

The category

返回值

A string on success.

参见

  • gettext() - Lookup a message in the current domain
add a noteadd a note

User Contributed Notes 2 notes

up
13
zak at nucleus dot com
21 years ago
The category argument allows a specific category of the locale settings to be used for fetching a message.  Valid categories are:

LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.

Note that the category must be specified with a numeric value, instead of the constant name.  The values are:

LC_CTYPE        0
LC_NUMERIC      1
LC_TIME         2
LC_COLLATE      3
LC_MONETARY     4
LC_MESSAGES     5
LC_ALL          6
up
1
chaosben at gmail dot com
1 year ago
As of today, you can use the LC_* constants as last parameter.

<?php
echo dcgettext('main', 'My Text', LC_MESSAGES);
?>

官方地址:https://www.php.net/manual/en/function.dcgettext.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3