LOCALE_LOOKUP(3) 1 LOCALE_LOOKUP(3)Locale::lookup - Searches the language tag list for the best match to the language
Object oriented style
SYNOPSIS
publicstatic string Locale::lookup (array $langtag, string $locale, [bool $canonicalize = false], [string $default])
DESCRIPTION
Procedural style
string locale_lookup (array $langtag, string $locale, [bool $canonicalize = false], [string $default])
Searches the items in $langtag for the best match to the language range specified in $locale according to RFC 4647's lookup algorithm.
PARAMETERS
o $langtag
- An array containing a list of language tags to compare to $locale. Maximum 100 items allowed.
o $locale
- The locale to use as the language range when matching.
o $canonicalize
- If true, the arguments will be converted to canonical form before matching.
o $default
- The locale to use if no match is found.
RETURN VALUES
The closest matching language tag or default value.
EXAMPLES
Example #1
locale_lookup(3) example
<?php
$arr = array(
'de-DEVA',
'de-DE-1996',
'de',
'de-De'
);
echo locale_lookup($arr, 'de-DE-1996-x-prv1-prv2', true, 'en_US');
?>
Example #2
OO example
<?php
$arr = array(
'de-DEVA',
'de-DE-1996',
'de',
'de-De'
);
echo Locale::lookup($arr, 'de-DE-1996-x-prv1-prv2', true, 'en_US');
?>
The above example will output:
de_de_1996
SEE ALSO locale_filter_matches(3).
PHP Documentation Group LOCALE_LOOKUP(3)
Check Out this Related Man Page
LOCALE_GET_PRIMARY_LANGUAGE(3) 1 LOCALE_GET_PRIMARY_LANGUAGE(3)Locale::getPrimaryLanguage - Gets the primary language for the input locale
Object oriented style
SYNOPSIS
publicstatic string Locale::getPrimaryLanguage (string $locale)
DESCRIPTION
Procedural style
string locale_get_primary_language (string $locale)
Gets the primary language for the input locale
PARAMETERS
o $locale
- The locale to extract the primary language code from
RETURN VALUES
The language code associated with the language or NULL in case of error.
EXAMPLES
Example #1
locale_get_primary_language(3) example
<?php
echo locale_get_primary_language('zh-Hant');
?>
Example #2
OO example
<?php
echo Locale::getPrimaryLanguage('zh-Hant');
?>
The above example will output:
zh
SEE ALSO locale_get_script(3), locale_get_region(3), locale_get_all_variants(3).
PHP Documentation Group LOCALE_GET_PRIMARY_LANGUAGE(3)
Hi gurus,
I need to set up an array like this
set - A arr 'A', 'B'
The output of this array should be like this 'A','B'
Right now, I get the output like this 'A B'
Can anyone suggest me on how to achieve this.
thanks (3 Replies)
Hi,
I have an array.
@arr=("abcdefgh","ppppppp","rrr");
$tofind="rrr";#string to find.
I want to match this string and retrieve only matched contents.
In this case rrr is found in 2nd position in an array i want to print only rrr.
If the string is matched i have to retrieve only... (1 Reply)
Hi,
I am new to scripting and need help splitting a string using space as the delimiter.
How can I do that?
I want the result to be stored in an Array.
I tried using
set -A arr $(echo $FILE)
echo $arr
The result of the above was ''.
Thanks. (2 Replies)
Hi Everyone,
I stored the result of a certain awk script in the variable arr.The result is /inets /banking /tools.
arr= /inets /banking /tools
These are 3 direcctories. I should be able to move in to these directories using "cd" command.Can you tell me how to extract... (5 Replies)
Hi I have the follwong command at the end of the program
print arr" "arr" "arr}
I would like to insert the tabs in these three values and 3 values should be in single line.
Would u guys plz :)suggest me what to do! (2 Replies)
Dear everyone...
thanks to this forum I am able to do everyday more and more complex scripts...but now I come up with problem with optimisation..
problem 1 - optimise:
here is my code:
while read number
do
nawk -F "|" -v... (8 Replies)
I have this code
echo $logfile | awk ' {arr++; next} END { for (i in arr) {print i} }'
that gives me this output
result1
result2
result3
I try to figure out how to get it like this
result1 result2 result3 (4 Replies)