aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/PhoneNumberUtil.php
blob: e53c7a51a1bb954e2777b747aaaa0fb56a7ce833 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

declare(strict_types=1);
/**
 * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace OC;

use libphonenumber\NumberParseException;
use libphonenumber\PhoneNumberFormat;
use OCP\IPhoneNumberUtil;

/**
 * @since 28.0.0
 */
class PhoneNumberUtil implements IPhoneNumberUtil {
	/**
	 * {@inheritDoc}
	 */
	public function getCountryCodeForRegion(string $regionCode): ?int {
		$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
		$countryCode = $phoneUtil->getCountryCodeForRegion($regionCode);
		return $countryCode === 0 ? null : $countryCode;
	}

	/**
	 * {@inheritDoc}
	 */
	public function convertToStandardFormat(string $input, ?string $defaultRegion = null): ?string {
		$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
		try {
			$phoneNumber = $phoneUtil->parse($input, $defaultRegion);
			if ($phoneUtil->isValidNumber($phoneNumber)) {
				return $phoneUtil->format($phoneNumber, PhoneNumberFormat::E164);
			}
		} catch (NumberParseException) {
		}

		return null;
	}
}
f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# 
# Translators:
# Claudiu <claudiu@tanaselia.ro>, 2011-2013
# Dimon Pockemon <>, 2012
# Dimon Pockemon <>, 2013
# Eugen Mihalache <eugemjj@gmail.com>, 2012
# g.ciprian <g.ciprian@osn.ro>, 2012-2013
# laurentiucristescu <laur.cristescu@gmail.com>, 2012
msgid ""
msgstr ""
"Project-Id-Version: ownCloud\n"
"Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
"POT-Creation-Date: 2013-04-26 01:55+0200\n"
"PO-Revision-Date: 2013-04-25 23:00+0000\n"
"Last-Translator: I Robot <owncloud-bot@tmit.eu>\n"
"Language-Team: Romanian (http://www.transifex.com/projects/p/owncloud/language/ro/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ro\n"
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"

#: ajax/move.php:17
#, php-format
msgid "Could not move %s - File with this name already exists"
msgstr "Nu se poate de mutat %s - Fișier cu acest nume deja există"

#: ajax/move.php:27 ajax/move.php:30
#, php-format
msgid "Could not move %s"
msgstr "Nu s-a putut muta %s"

#: ajax/rename.php:22 ajax/rename.php:25
msgid "Unable to rename file"
msgstr "Nu s-a putut redenumi fișierul"

#: ajax/upload.php:19
msgid "No file was uploaded. Unknown error"
msgstr "Nici un fișier nu a fost încărcat. Eroare necunoscută"

#: ajax/upload.php:26
msgid "There is no error, the file uploaded with success"
msgstr "Nicio eroare, fișierul a fost încărcat cu succes"

#: ajax/upload.php:27
msgid ""
"The uploaded file exceeds the upload_max_filesize directive in php.ini: "
msgstr "Fisierul incarcat depaseste upload_max_filesize permisi in php.ini: "

#: ajax/upload.php:29
msgid ""
"The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in "
"the HTML form"
msgstr "Fișierul are o dimensiune mai mare decât variabile MAX_FILE_SIZE specificată în formularul HTML"

#: ajax/upload.php:30
msgid "The uploaded file was only partially uploaded"
msgstr "Fișierul a fost încărcat doar parțial"

#: ajax/upload.php:31
msgid "No file was uploaded"
msgstr "Niciun fișier încărcat"

#: ajax/upload.php:32
msgid "Missing a temporary folder"
msgstr "Lipsește un dosar temporar"

#: ajax/upload.php:33
msgid "Failed to write to disk"
msgstr "Eroare la scriere pe disc"

#: ajax/upload.php:51
msgid "Not enough storage available"
msgstr ""

#: ajax/upload.php:83
msgid "Invalid directory."
msgstr "Director invalid."

#: appinfo/app.php:12
msgid "Files"
msgstr "Fișiere"

#: js/fileactions.js:116
msgid "Share"
msgstr "Partajează"

#: js/fileactions.js:126
msgid "Delete permanently"
msgstr ""

#: js/fileactions.js:128 templates/index.php:94 templates/index.php:95
msgid "Delete"
msgstr "Șterge"

#: js/fileactions.js:194
msgid "Rename"
msgstr "Redenumire"

#: js/filelist.js:49 js/filelist.js:52 js/filelist.js:414
msgid "Pending"
msgstr "În așteptare"

#: js/filelist.js:252 js/filelist.js:254
msgid "{new_name} already exists"
msgstr "{new_name} deja exista"

#: js/filelist.js:252 js/filelist.js:254
msgid "replace"
msgstr "înlocuire"

#: js/filelist.js:252
msgid "suggest name"
msgstr "sugerează nume"

#: js/filelist.js:252 js/filelist.js:254
msgid "cancel"
msgstr "anulare"

#: js/filelist.js:299
msgid "replaced {new_name} with {old_name}"
msgstr "{new_name} inlocuit cu {old_name}"

#: js/filelist.js:299
msgid "undo"
msgstr "Anulează ultima acțiune"

#: js/filelist.js:324
msgid "perform delete operation"
msgstr ""

#: js/filelist.js:406
msgid "1 file uploading"
msgstr "un fișier se încarcă"

#: js/filelist.js:409 js/filelist.js:463
msgid "files uploading"
msgstr ""

#: js/files.js:52
msgid "'.' is an invalid file name."
msgstr "'.' este un nume invalid de fișier."

#: js/files.js:56
msgid "File name cannot be empty."
msgstr "Numele fișierului nu poate rămâne gol."

#: js/files.js:64
msgid ""
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not "
"allowed."
msgstr "Nume invalid, '\\', '/', '<', '>', ':', '\"', '|', '?' si '*' nu sunt permise."

#: js/files.js:78
msgid "Your storage is full, files can not be updated or synced anymore!"
msgstr ""

#: js/files.js:82
msgid "Your storage is almost full ({usedSpacePercent}%)"
msgstr ""

#: js/files.js:226
msgid ""
"Your download is being prepared. This might take some time if the files are "
"big."
msgstr "Se pregătește descărcarea. Aceasta poate să dureze ceva timp dacă fișierele sunt mari."

#: js/files.js:259
msgid "Unable to upload your file as it is a directory or has 0 bytes"
msgstr "Nu s-a putut încărca fișierul tău deoarece pare să fie un director sau are 0 bytes."

#: js/files.js:272
msgid "Not enough space available"
msgstr "Nu este suficient spațiu disponibil"

#: js/files.js:312
msgid "Upload cancelled."
msgstr "Încărcare anulată."

#: js/files.js:408
msgid ""
"File upload is in progress. Leaving the page now will cancel the upload."
msgstr "Fișierul este în curs de încărcare. Părăsirea paginii va întrerupe încărcarea."

#: js/files.js:481
msgid "URL cannot be empty."
msgstr "Adresa URL nu poate fi goală."

#: js/files.js:486
msgid "Invalid folder name. Usage of 'Shared' is reserved by Owncloud"
msgstr "Invalid folder name. Usage of 'Shared' is reserved by Ownclou"

#: js/files.js:515 js/files.js:531 js/files.js:821 js/files.js:859
msgid "Error"
msgstr "Eroare"

#: js/files.js:872 templates/index.php:70
msgid "Name"
msgstr "Nume"

#: js/files.js:873 templates/index.php:81
msgid "Size"
msgstr "Dimensiune"

#: js/files.js:874 templates/index.php:83
msgid "Modified"
msgstr "Modificat"

#: js/files.js:893
msgid "1 folder"
msgstr "1 folder"

#: js/files.js:895
msgid "{count} folders"
msgstr "{count} foldare"

#: js/files.js:903
msgid "1 file"
msgstr "1 fisier"

#: js/files.js:905
msgid "{count} files"
msgstr "{count} fisiere"

#: lib/helper.php:11 templates/index.php:18
msgid "Upload"
msgstr "Încarcă"

#: templates/admin.php:5
msgid "File handling"
msgstr "Manipulare fișiere"

#: templates/admin.php:7
msgid "Maximum upload size"
msgstr "Dimensiune maximă admisă la încărcare"

#: templates/admin.php:10
msgid "max. possible: "
msgstr "max. posibil:"

#: templates/admin.php:15
msgid "Needed for multi-file and folder downloads."
msgstr "Necesar pentru descărcarea mai multor fișiere și a dosarelor"

#: templates/admin.php:17
msgid "Enable ZIP-download"
msgstr "Activează descărcare fișiere compresate"

#: templates/admin.php:20
msgid "0 is unlimited"
msgstr "0 e nelimitat"

#: templates/admin.php:22
msgid "Maximum input size for ZIP files"
msgstr "Dimensiunea maximă de intrare pentru fișiere compresate"

#: templates/admin.php:26
msgid "Save"
msgstr "Salvare"

#: templates/index.php:7
msgid "New"
msgstr "Nou"

#: templates/index.php:10
msgid "Text file"
msgstr "Fișier text"

#: templates/index.php:12
msgid "Folder"
msgstr "Dosar"

#: templates/index.php:14
msgid "From link"
msgstr "de la adresa"

#: templates/index.php:42
msgid "Deleted files"
msgstr ""

#: templates/index.php:48
msgid "Cancel upload"
msgstr "Anulează încărcarea"

#: templates/index.php:55
msgid "You don’t have write permissions here."
msgstr ""

#: templates/index.php:62
msgid "Nothing in here. Upload something!"
msgstr "Nimic aici. Încarcă ceva!"

#: templates/index.php:76
msgid "Download"
msgstr "Descarcă"

#: templates/index.php:88 templates/index.php:89
msgid "Unshare"
msgstr "Anulează partajarea"

#: templates/index.php:108
msgid "Upload too large"
msgstr "Fișierul încărcat este prea mare"

#: templates/index.php:110
msgid ""
"The files you are trying to upload exceed the maximum size for file uploads "
"on this server."
msgstr "Fișierul care l-ai încărcat a depășită limita maximă admisă la încărcare pe acest server."

#: templates/index.php:115
msgid "Files are being scanned, please wait."
msgstr "Fișierele sunt scanate, te rog așteptă."

#: templates/index.php:118
msgid "Current scanning"
msgstr "În curs de scanare"

#: templates/upgrade.php:2
msgid "Upgrading filesystem cache..."
msgstr ""