aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/intl/pluralrules/select/index.md
blob: cc4c837203708369660af17cba7af78e1e75948f (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
title: Intl.PluralRules.select()
slug: Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/select
tags:
  - Internationalisation
  - Intl
  - JavaScript
  - Méthode
  - PluralRules
  - Reference
translation_of: Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/select
original_slug: Web/JavaScript/Reference/Objets_globaux/Intl/PluralRules/select
---
{{JSRef}}

La méthode **`Intl.PluralRules.prototype.select`** renvoie une chaîne de caractères qui indique la règle de nombre utilisée pour le formatage relatif à la locale.

## Syntaxe

    pluralRule.select(nombre)

### Paramètres

- `nombre`
  - : Le nombre pour lequel on souhaite obtenir la règle de nombre associée.

## Description

Cette fonction permet de sélectionner une règle de nombre en fonction de la locale et des options de formatage choisies via un objet {{jsxref("PluralRules")}}.

## Exemples

```js
 new Intl.PluralRules('ar-EG').select(0);
// → 'zero'

new Intl.PluralRules('ar-EG').select(1);
// → 'one'

new Intl.PluralRules('ar-EG').select(2);
// → 'two'

new Intl.PluralRules('ar-EG').select(6);
// → 'few'

new Intl.PluralRules('ar-EG').select(18);
// → 'many'
```

## Spécifications

| Spécification                                                                                                       | État                             | Commentaires         |
| ------------------------------------------------------------------------------------------------------------------- | -------------------------------- | -------------------- |
| [Brouillon pour les règles de nombre avec Intl](https://rawgit.com/caridy/intl-plural-rules-spec/master/index.html) | {{Spec2('ES Int Draft')}} | Définition initiale. |

## Compatibilité des navigateurs

{{Compat("javascript.builtins.Intl.PluralRules.select")}}

## Voir aussi

- {{jsxref("PluralRules", "Intl.PluralRules")}}