Skip to content

Commit 4a99458

Browse files
committed
[reference/intl] sync with en
1 parent b200e7c commit 4a99458

File tree

10 files changed

+118
-33
lines changed

10 files changed

+118
-33
lines changed

reference/intl/collator/get-sort-key.xml

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 1976eae0d815797af97a1e16c5cd90ffc2868395 Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: bfc89e697fd685a7d15177f0b014eba70c5f9931 Maintainer: takagi Status: ready -->
44
<!-- Credits: mumumu -->
55
<refentry xml:id="collator.getsortkey" xmlns="http://docbook.org/ns/docbook">
66
<refnamediv>
@@ -87,6 +87,76 @@ echo bin2hex($res);
8787
</screen>
8888
</example>
8989
</para>
90+
91+
<para>
92+
<example>
93+
<title><function>Collator::getSortKey</function> を <function>usort</function> と一緒に使う例</title>
94+
<programlisting role="php">
95+
<![CDATA[
96+
<?php
97+
$data = [
98+
[ 'name' => '🇳🇱 Derick Rethans', 'linked_account' => 'https://phpc.social/users/derickr' ],
99+
[ 'name' => 'Elephpant', 'linked_account' => 'https://phpc.social/phpc' ],
100+
[ 'name' => '🇫🇷 Marcus Bointon', 'linked_account' => 'https://phpc.social/users/Synchro' ],
101+
];
102+
103+
/* Create the collator */
104+
$col = new Collator('en');
105+
106+
/* Sort upper-case letters before lower-case letters */
107+
$col->setAttribute(Collator::CASE_FIRST, Collator::UPPER_FIRST);
108+
109+
/* Use a user-defined function with sort, that strips out the emojis */
110+
*/
111+
usort(
112+
$data,
113+
function($a, $b) use ($col) {
114+
/* Remove the character class 'S' (the Symbols), and remove whitespace
115+
* (with trim) */
116+
$aName = trim(preg_replace('/\p{S}+/u', '', $a['name']));
117+
$bName = trim(preg_replace('/\p{S}+/u', '', $b['name']));
118+
119+
/* Create the sort key */
120+
$aKey = $col->getSortKey($aName);
121+
$bKey = $col->getSortKey($bName);
122+
123+
/* Use the sort key to signal which element sorts first */
124+
return $aKey <=> $bKey;
125+
}
126+
);
127+
128+
var_dump($data);
129+
?>
130+
]]>
131+
</programlisting>
132+
&example.outputs.similar;
133+
<screen>
134+
array(3) {
135+
[0] =>
136+
array(2) {
137+
'name' =>
138+
string(25) "🇳🇱 Derick Rethans"
139+
'linked_account' =>
140+
string(33) "https://phpc.social/users/derickr"
141+
}
142+
[1] =>
143+
array(2) {
144+
'name' =>
145+
string(9) "Elephpant"
146+
'linked_account' =>
147+
string(24) "https://phpc.social/phpc"
148+
}
149+
[2] =>
150+
array(2) {
151+
'name' =>
152+
string(25) "🇫🇷 Marcus Bointon"
153+
'linked_account' =>
154+
string(33) "https://phpc.social/users/Synchro"
155+
}
156+
}
157+
</screen>
158+
</example>
159+
</para>
90160
</refsect1>
91161

92162
<refsect1 role="seealso">

reference/intl/dateformatter/localtime.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 1976eae0d815797af97a1e16c5cd90ffc2868395 Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: 8ddf539e5993e427cb1385c5a01b6d2ce971b418 Maintainer: takagi Status: ready -->
44
<refentry xml:id="intldateformatter.localtime" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
66
<refname>IntlDateFormatter::localtime</refname>
@@ -94,7 +94,7 @@ $fmt = datefmt_create(
9494
'America/Los_Angeles',
9595
IntlDateFormatter::GREGORIAN
9696
);
97-
$arr = datefmt_localtime($fmt, 'Wednesday, December 31, 1969 4:00:00 PM PT', 0);
97+
$arr = datefmt_localtime($fmt, 'Wednesday, December 31, 1969 at 4:00:00 PM Pacific Standard Time', $offset);
9898
echo 'First parsed output is ';
9999
if ($arr) {
100100
foreach ($arr as $key => $value) {
@@ -118,7 +118,7 @@ $fmt = new IntlDateFormatter(
118118
'America/Los_Angeles',
119119
IntlDateFormatter::GREGORIAN
120120
);
121-
$arr = $fmt->localtime('Wednesday, December 31, 1969 4:00:00 PM PT', 0);
121+
$arr = $fmt->localtime('Wednesday, December 31, 1969 at 4:00:00 PM Pacific Standard Time', $offset);
122122
echo 'First parsed output is ';
123123
if ($arr) {
124124
foreach ($arr as $key => $value) {
@@ -133,8 +133,8 @@ if ($arr) {
133133
&example.outputs;
134134
<screen>
135135
<![CDATA[
136-
First parsed output is tm_sec : 0 , tm_min : 0 , tm_hour : 16 , tm_year : 1969 ,
137-
tm_mday : 31 , tm_wday : 4 , tm_yday : 365 , tm_mon : 11 , tm_isdst : 0 ,
136+
First parsed output is tm_sec : 0 , tm_min : 0 , tm_hour : 16 , tm_year : 69 ,
137+
tm_mday : 31 , tm_wday : 3 , tm_yday : 365 , tm_mon : 11 , tm_isdst : 0 ,
138138
]]>
139139
</screen>
140140
</refsect1>

reference/intl/idn/idn-to-ascii.xml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: b548fc8e5592b577d29aabf9cf2e79d5385ae549 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: e908bfda98eb9fe16fb2c1b5773f312e5c684ee3 Maintainer: mumumu Status: ready -->
44
<refentry xml:id="function.idn-to-ascii" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
66
<refname>idn_to_ascii</refname>
@@ -17,7 +17,7 @@
1717
<methodparam choice="opt"><type>array</type><parameter role="reference">idna_info</parameter><initializer>&null;</initializer></methodparam>
1818
</methodsynopsis>
1919
<para>
20-
Unicode のドメイン名を、IDNAが定めたASCII形式に変換します
20+
Unicode のドメイン名を、IDNAが定めたASCII形式(小文字)に変換します
2121
</para>
2222
</refsect1>
2323

@@ -120,7 +120,7 @@
120120
<![CDATA[
121121
<?php
122122
123-
echo idn_to_ascii('tast.de');
123+
echo idn_to_ascii('täst.de');
124124
125125
?>
126126
]]>
@@ -130,6 +130,24 @@ echo idn_to_ascii('tast.de');
130130
<screen>
131131
<![CDATA[
132132
xn--tst-qla.de
133+
]]>
134+
</screen>
135+
<example>
136+
<title>全てASCIIで構成されたドメイン名は、小文字に変換される</title>
137+
<programlisting role="php">
138+
<![CDATA[
139+
<?php
140+
141+
var_dump(idn_to_ascii('Example.com'));
142+
143+
?>
144+
]]>
145+
</programlisting>
146+
</example>
147+
&example.outputs;
148+
<screen>
149+
<![CDATA[
150+
string(11) "example.com"
133151
]]>
134152
</screen>
135153
</refsect1>

reference/intl/intlcalendar/fromdatetime.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 1976eae0d815797af97a1e16c5cd90ffc2868395 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: bce2cb849721c70737eb32ce958131e22677770c Maintainer: mumumu Status: ready -->
44
<refentry xml:id="intlcalendar.fromdatetime" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
66
<refname>IntlCalendar::fromDateTime</refname>
@@ -83,7 +83,7 @@
8383
ini_set('date.timezone', 'Europe/Lisbon');
8484
8585
//same as IntlCalendar::fromDateTime(new DateTime(...))
86-
$cal1 = IntlCalendar::fromDateTime('2013-02-28 00:01:02 Europe/Berlin');
86+
$cal1 = IntlCalendar::fromDateTime('2013-02-28 00:01:02 Europe/Berlin', 'de_DE');
8787
8888
//Note the timezone is Europe/Berlin, not the default Europe/Lisbon
8989
echo IntlDateFormatter::formatObject($cal1, 'yyyy MMMM d HH:mm:ss VVVV', 'de_DE'), "\n";

reference/intl/intlchar/chardirection.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 1976eae0d815797af97a1e16c5cd90ffc2868395 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: e8ac70bf549a723cb36465667a6109d9933b8619 Maintainer: mumumu Status: ready -->
44
<refentry xml:id="intlchar.chardirection" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
66
<refname>IntlChar::charDirection</refname>
@@ -14,7 +14,8 @@
1414
<methodparam><type class="union"><type>int</type><type>string</type></type><parameter>codepoint</parameter></methodparam>
1515
</methodsynopsis>
1616
<para>
17-
<link xlink:href="http://www.unicode.org/reports/tr9/">Unicode bidirectional algorithm (UAX #9)</link> で使われる、コードポイントの双方向カテゴリの値を返します。
17+
<link xlink:href="&url.unicode.bidirectional;">Unicode bidirectional algorithm (UAX #9)</link>
18+
で使われる、コードポイントの双方向カテゴリの値を返します。
1819
</para>
1920
<note>
2021
<para>

reference/intl/intlchar/getbidipairedbracket.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 6e6cdaf9b8a75fec87e6993e6bdb3e83c8783bcd Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 454c84c4f32c4b3660446650e4618f13e8710025 Maintainer: mumumu Status: ready -->
44
<refentry xml:id="intlchar.getbidipairedbracket" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
66
<refname>IntlChar::getBidiPairedBracket</refname>
@@ -17,7 +17,7 @@
1717
指定された文字を、それと対になる括弧文字にマップします。
1818
</para>
1919
<para>
20-
<literal>Bidi_Paired_Bracket_Type!=None</literal> の場合、
20+
<code>IntlChar::PROPERTY_BIDI_PAIRED_BRACKET_TYPE !== IntlChar::BPT_NONE</code> の場合、
2121
これは <function>IntlChar::charMirror</function> と同等です。
2222
そうでない場合、<parameter>codepoint</parameter>
2323
そのものを返します。

reference/intl/intlchar/hasbinaryproperty.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 1976eae0d815797af97a1e16c5cd90ffc2868395 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: e8ac70bf549a723cb36465667a6109d9933b8619 Maintainer: mumumu Status: ready -->
44
<refentry xml:id="intlchar.hasbinaryproperty" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
66
<refname>IntlChar::hasBinaryProperty</refname>
@@ -30,7 +30,7 @@
3030
Unicode Technical Reports (UTR)
3131
で定義されている Unicode プロパティを反映したものを意図しています。
3232
プロパティの詳細については、
33-
<link xlink:href="http://www.unicode.org/ucd/">http://www.unicode.org/ucd/</link>
33+
<link xlink:href="&url.unicode.ucd;">&url.unicode.ucd;</link>
3434
を参照ください。
3535
Unicode プロパティの名前については、
3636
UCD ファイル PropertyAliases.txt を参照ください。

reference/intl/intlchar/totitle.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: a37831eed5d1b161050cecd44fd5f8e826a70597 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 22583751fbfdaa3eaa41aeb6470d1343f5cb2c78 Maintainer: mumumu Status: ready -->
44
<refentry xml:id="intlchar.totitle" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
66
<refname>IntlChar::totitle</refname>
@@ -53,7 +53,7 @@ var_dump(IntlChar::totitle("dž"));
5353
var_dump(IntlChar::totitle("Φ"));
5454
var_dump(IntlChar::totitle("φ"));
5555
var_dump(IntlChar::totitle("1"));
56-
var_dump(IntlChar::totitle("ᾳ");
56+
var_dump(IntlChar::totitle("ᾳ"));
5757
var_dump(IntlChar::totitle(ord("A")));
5858
?>
5959
]]>

reference/intl/numberformatter/format.xml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 1976eae0d815797af97a1e16c5cd90ffc2868395 Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: bce2cb849721c70737eb32ce958131e22677770c Maintainer: takagi Status: ready -->
44
<refentry xml:id="numberformatter.format" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
66
<refname>NumberFormatter::format</refname>
@@ -91,9 +91,7 @@
9191
<?php
9292
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
9393
$data = numfmt_format($fmt, 1234567.891234567890000);
94-
if(intl_is_failure(numfmt_format($fmt))) {
95-
report_error("Formatter error");
96-
}
94+
var_dump($data);
9795
?>
9896
]]>
9997
</programlisting>
@@ -104,18 +102,16 @@ if(intl_is_failure(numfmt_format($fmt))) {
104102
<![CDATA[
105103
<?php
106104
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL );
107-
$fmt->format(1234567.891234567890000);
108-
if(intl_is_failure($fmt->getErrorCode())) {
109-
report_error("Formatter error");
110-
}
105+
$data = $fmt->format(1234567.891234567890000);
106+
var_dump($data);
111107
?>
112108
]]>
113109
</programlisting>
114110
</example>
115111
&example.outputs;
116112
<screen>
117113
<![CDATA[
118-
1.234.567,891
114+
string(13) "1.234.567,891"
119115
]]>
120116
</screen>
121117
</refsect1>

reference/intl/numberformatter/get-error-code.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 1976eae0d815797af97a1e16c5cd90ffc2868395 Maintainer: takagi Status: ready -->
3+
<!-- EN-Revision: bce2cb849721c70737eb32ce958131e22677770c Maintainer: takagi Status: ready -->
44
<refentry xml:id="numberformatter.geterrorcode" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<refnamediv>
66
<refname>NumberFormatter::getErrorCode</refname>
@@ -62,8 +62,8 @@
6262
<?php
6363
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
6464
$data = numfmt_format($fmt, 1234567.891234567890000);
65-
if(intl_is_failure(numfmt_get_error_code($fmt))) {
66-
report_error("Formatter error");
65+
if (intl_is_failure(numfmt_get_error_code($fmt))) {
66+
echo 'Formatter error';
6767
}
6868
?>
6969
]]>
@@ -76,8 +76,8 @@ if(intl_is_failure(numfmt_get_error_code($fmt))) {
7676
<?php
7777
$fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL );
7878
$fmt->format(1234567.891234567890000);
79-
if(intl_is_failure($fmt->getErrorCode())) {
80-
report_error("Formatter error");
79+
if (intl_is_failure($fmt->getErrorCode())) {
80+
echo 'Formatter error';
8181
}
8282
?>
8383
]]>

0 commit comments

Comments
 (0)