% phonenumbers package: phonenumbers-FR.def
% Module for French telephone numbers
% Author: K. Wehr
% Version: 2.7
% Date: 2026-06-25
\clist_const:Nn \c_phone_FR_geographic_area_codes_clist {01,
02,
0262,
026200,
0263,
02688,
02689,
0269,
03,
04,
05,
0508,
0590,
0591,
0594,
0596,
0597,
05987,
05988,
05989,
09,
09475,
09476,
09477,
09478,
09479,
09760,
09761,
09762,
09763,
09764,
09765,
09766,
09767,
09768,
09769,
09900}
\clist_const:Nn \c_phone_FR_nongeographic_area_codes_clist {01510,
02687,
02810,
03410,
04410,
050860,
05410,
059850,
059851,
059852,
059853,
059854,
059855,
059856,
059857,
059858,
059859,
059860,
059861,
059862,
059863,
059864,
06,
0639,
0690,
0691,
0692,
0693,
0694,
0696,
0697,
07,
0700,
07005,
07006,
07007,
07008,
07009,
0708,
08,
0901,
09015,
09016,
09017,
09018,
09019,
0937,
0938,
0939,
09395,
09396,
09397,
09398,
09399,
09410,
094700,
094701,
094702,
094703,
094704,
094705,
094706,
094707,
094708,
094709}
\tl_const:cn {c_phone_FR_place_name_01_tl} {France~m\a'{e}tropolitaine}
\tl_const:cn {c_phone_FR_place_name_02_tl} {France~m\a'{e}tropolitaine}
\tl_const:cn {c_phone_FR_place_name_0262_tl} {La~R\a'{e}union}
\tl_const:cn {c_phone_FR_place_name_026200_tl} {Terres~australes~et~antarctiques~fran\c{c}aises}
\tl_const:cn {c_phone_FR_place_name_0263_tl} {La~R\a'{e}union}
\tl_const:cn {c_phone_FR_place_name_02688_tl} {La~R\a'{e}union}
\tl_const:cn {c_phone_FR_place_name_02689_tl} {Mayotte}
\tl_const:cn {c_phone_FR_place_name_0269_tl} {Mayotte}
\tl_const:cn {c_phone_FR_place_name_03_tl} {France~m\a'{e}tropolitaine}
\tl_const:cn {c_phone_FR_place_name_04_tl} {France~m\a'{e}tropolitaine}
\tl_const:cn {c_phone_FR_place_name_05_tl} {France~m\a'{e}tropolitaine}
\tl_const:cn {c_phone_FR_place_name_0508_tl} {Saint-Pierre-et-Miquelon}
\tl_const:cn {c_phone_FR_place_name_0590_tl} {Guadeloupe,~Saint-Barth\a'{e}lemy,~Saint-Martin}
\tl_const:cn {c_phone_FR_place_name_0591_tl} {Guadeloupe,~Saint-Barth\a'{e}lemy,~Saint-Martin}
\tl_const:cn {c_phone_FR_place_name_0594_tl} {Guyane}
\tl_const:cn {c_phone_FR_place_name_0596_tl} {Martinique}
\tl_const:cn {c_phone_FR_place_name_0597_tl} {Martinique}
\tl_const:cn {c_phone_FR_place_name_05987_tl} {Guadeloupe,~Saint-Barth\a'{e}lemy,~Saint-Martin}
\tl_const:cn {c_phone_FR_place_name_05988_tl} {Guyane}
\tl_const:cn {c_phone_FR_place_name_05989_tl} {Martinique}
\tl_const:cn {c_phone_FR_place_name_09_tl} {France~m\a'{e}tropolitaine}
\tl_const:cn {c_phone_FR_place_name_09475_tl} {Guadeloupe,~Saint-Barth\a'{e}lemy,~Saint-Martin}
\tl_const:cn {c_phone_FR_place_name_09476_tl} {Guyane}
\tl_const:cn {c_phone_FR_place_name_09477_tl} {Martinique}
\tl_const:cn {c_phone_FR_place_name_09478_tl} {Mayotte}
\tl_const:cn {c_phone_FR_place_name_09479_tl} {La~R\a'{e}union}
\tl_const:cn {c_phone_FR_place_name_09760_tl} {Guadeloupe,~Saint-Barth\a'{e}lemy,~Saint-Martin}
\tl_const:cn {c_phone_FR_place_name_09761_tl} {Guadeloupe,~Saint-Barth\a'{e}lemy,~Saint-Martin}
\tl_const:cn {c_phone_FR_place_name_09762_tl} {La~R\a'{e}union}
\tl_const:cn {c_phone_FR_place_name_09763_tl} {La~R\a'{e}union}
\tl_const:cn {c_phone_FR_place_name_09764_tl} {Guyane}
\tl_const:cn {c_phone_FR_place_name_09765_tl} {Guyane}
\tl_const:cn {c_phone_FR_place_name_09766_tl} {Martinique}
\tl_const:cn {c_phone_FR_place_name_09767_tl} {Martinique}
\tl_const:cn {c_phone_FR_place_name_09768_tl} {Guadeloupe,~Saint-Barth\a'{e}lemy,~Saint-Martin}
\tl_const:cn {c_phone_FR_place_name_09769_tl} {Mayotte}
\tl_const:cn {c_phone_FR_place_name_09900_tl} {Mayotte}
\tl_const:cn {c_phone_FR_place_name_01510_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral}
\tl_const:cn {c_phone_FR_place_name_02687_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(La~R\a'{e}union,~Mayotte)}
\tl_const:cn {c_phone_FR_place_name_02810_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral}
\tl_const:cn {c_phone_FR_place_name_03410_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral}
\tl_const:cn {c_phone_FR_place_name_04410_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral}
\tl_const:cn {c_phone_FR_place_name_050860_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Saint-Pierre-et-Miquelon)}
\tl_const:cn {c_phone_FR_place_name_05410_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral}
\tl_const:cn {c_phone_FR_place_name_059850_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_059851_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_059852_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_059853_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_059854_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_059855_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guyane)}
\tl_const:cn {c_phone_FR_place_name_059856_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guyane)}
\tl_const:cn {c_phone_FR_place_name_059857_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guyane)}
\tl_const:cn {c_phone_FR_place_name_059858_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guyane)}
\tl_const:cn {c_phone_FR_place_name_059859_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guyane)}
\tl_const:cn {c_phone_FR_place_name_059860_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_059861_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_059862_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_059863_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_059864_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_06_tl} {T\a'{e}l\a'{e}phone~mobile}
\tl_const:cn {c_phone_FR_place_name_0639_tl} {T\a'{e}l\a'{e}phone~mobile~(Mayotte)}
\tl_const:cn {c_phone_FR_place_name_0690_tl} {T\a'{e}l\a'{e}phone~mobile~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_0691_tl} {T\a'{e}l\a'{e}phone~mobile~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_0692_tl} {T\a'{e}l\a'{e}phone~mobile~(La~R\a'{e}union)}
\tl_const:cn {c_phone_FR_place_name_0693_tl} {T\a'{e}l\a'{e}phone~mobile~(La~R\a'{e}union)}
\tl_const:cn {c_phone_FR_place_name_0694_tl} {T\a'{e}l\a'{e}phone~mobile~(Guyane)}
\tl_const:cn {c_phone_FR_place_name_0696_tl} {T\a'{e}l\a'{e}phone~mobile~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_0697_tl} {T\a'{e}l\a'{e}phone~mobile~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_07_tl} {T\a'{e}l\a'{e}phone~mobile}
\tl_const:cn {c_phone_FR_place_name_0700_tl} {Communication~machine~\a`{a}~machine}
\tl_const:cn {c_phone_FR_place_name_07005_tl} {Communication~machine~\a`{a}~machine~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_07006_tl} {Communication~machine~\a`{a}~machine~(Guyane)}
\tl_const:cn {c_phone_FR_place_name_07007_tl} {Communication~machine~\a`{a}~machine~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_07008_tl} {Communication~machine~\a`{a}~machine~(Mayotte)}
\tl_const:cn {c_phone_FR_place_name_07009_tl} {Communication~machine~\a`{a}~machine~(La~R\a'{e}union)}
\tl_const:cn {c_phone_FR_place_name_0708_tl} {T\a'{e}l\a'{e}phone~mobile~(Saint-Pierre-et-Miquelon)}
\tl_const:cn {c_phone_FR_place_name_08_tl} {Service~\a`{a}~valeur~ajout\a'{e}e}
\tl_const:cn {c_phone_FR_place_name_0901_tl} {Communication~machine~\a`{a}~machine}
\tl_const:cn {c_phone_FR_place_name_09015_tl} {Communication~machine~\a`{a}~machine~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_09016_tl} {Communication~machine~\a`{a}~machine~(Guyane)}
\tl_const:cn {c_phone_FR_place_name_09017_tl} {Communication~machine~\a`{a}~machine~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_09018_tl} {Communication~machine~\a`{a}~machine~(Mayotte)}
\tl_const:cn {c_phone_FR_place_name_09019_tl} {Communication~machine~\a`{a}~machine~(La~R\a'{e}union)}
\tl_const:cn {c_phone_FR_place_name_0937_tl} {\a'{E}change~avec~une~plateforme~technique}
\tl_const:cn {c_phone_FR_place_name_0938_tl} {\a'{E}change~avec~une~plateforme~technique}
\tl_const:cn {c_phone_FR_place_name_0939_tl} {\a'{E}change~avec~une~plateforme~technique}
\tl_const:cn {c_phone_FR_place_name_09395_tl} {\a'{E}change~avec~une~plateforme~technique~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_09396_tl} {\a'{E}change~avec~une~plateforme~technique~(Guyane)}
\tl_const:cn {c_phone_FR_place_name_09397_tl} {\a'{E}change~avec~une~plateforme~technique~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_09398_tl} {\a'{E}change~avec~une~plateforme~technique~(Mayotte)}
\tl_const:cn {c_phone_FR_place_name_09399_tl} {\a'{E}change~avec~une~plateforme~technique~(La~R\a'{e}union)}
\tl_const:cn {c_phone_FR_place_name_09410_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral}
\tl_const:cn {c_phone_FR_place_name_094700_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_094701_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guadeloupe)}
\tl_const:cn {c_phone_FR_place_name_094702_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guyane)}
\tl_const:cn {c_phone_FR_place_name_094703_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Guyane)}
\tl_const:cn {c_phone_FR_place_name_094704_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_094705_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Martinique)}
\tl_const:cn {c_phone_FR_place_name_094706_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(La~R\a'{e}union)}
\tl_const:cn {c_phone_FR_place_name_094707_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(La~R\a'{e}union)}
\tl_const:cn {c_phone_FR_place_name_094708_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Mayotte)}
\tl_const:cn {c_phone_FR_place_name_094709_tl} {Appel~d'int\a'{e}r\a^{e}t~g\a'{e}n\a'{e}ral~(Mayotte)}
\str_const:cn {c_phone_FR_country_code_01_str} {33}
\str_const:cn {c_phone_FR_country_code_02_str} {33}
\str_const:cn {c_phone_FR_country_code_0262_str} {262}
\str_const:cn {c_phone_FR_country_code_026200_str} {262}
\str_const:cn {c_phone_FR_country_code_0263_str} {262}
\str_const:cn {c_phone_FR_country_code_02688_str} {262}
\str_const:cn {c_phone_FR_country_code_02689_str} {262}
\str_const:cn {c_phone_FR_country_code_0269_str} {262}
\str_const:cn {c_phone_FR_country_code_03_str} {33}
\str_const:cn {c_phone_FR_country_code_04_str} {33}
\str_const:cn {c_phone_FR_country_code_05_str} {33}
\str_const:cn {c_phone_FR_country_code_0508_str} {508}
\str_const:cn {c_phone_FR_country_code_0590_str} {590}
\str_const:cn {c_phone_FR_country_code_0591_str} {590}
\str_const:cn {c_phone_FR_country_code_0594_str} {594}
\str_const:cn {c_phone_FR_country_code_0596_str} {596}
\str_const:cn {c_phone_FR_country_code_0597_str} {596}
\str_const:cn {c_phone_FR_country_code_05987_str} {590}
\str_const:cn {c_phone_FR_country_code_05988_str} {594}
\str_const:cn {c_phone_FR_country_code_05989_str} {596}
\str_const:cn {c_phone_FR_country_code_09_str} {33}
\str_const:cn {c_phone_FR_country_code_09475_str} {590}
\str_const:cn {c_phone_FR_country_code_09476_str} {594}
\str_const:cn {c_phone_FR_country_code_09477_str} {596}
\str_const:cn {c_phone_FR_country_code_09478_str} {262}
\str_const:cn {c_phone_FR_country_code_09479_str} {262}
\str_const:cn {c_phone_FR_country_code_09760_str} {590}
\str_const:cn {c_phone_FR_country_code_09761_str} {590}
\str_const:cn {c_phone_FR_country_code_09762_str} {262}
\str_const:cn {c_phone_FR_country_code_09763_str} {262}
\str_const:cn {c_phone_FR_country_code_09764_str} {594}
\str_const:cn {c_phone_FR_country_code_09765_str} {594}
\str_const:cn {c_phone_FR_country_code_09766_str} {596}
\str_const:cn {c_phone_FR_country_code_09767_str} {596}
\str_const:cn {c_phone_FR_country_code_09768_str} {590}
\str_const:cn {c_phone_FR_country_code_09769_str} {262}
\str_const:cn {c_phone_FR_country_code_09900_str} {262}
\str_const:cn {c_phone_FR_country_code_01510_str} {33}
\str_const:cn {c_phone_FR_country_code_02687_str} {262}
\str_const:cn {c_phone_FR_country_code_02810_str} {33}
\str_const:cn {c_phone_FR_country_code_03410_str} {33}
\str_const:cn {c_phone_FR_country_code_04410_str} {33}
\str_const:cn {c_phone_FR_country_code_050860_str} {508}
\str_const:cn {c_phone_FR_country_code_05410_str} {33}
\str_const:cn {c_phone_FR_country_code_059850_str} {590}
\str_const:cn {c_phone_FR_country_code_059851_str} {590}
\str_const:cn {c_phone_FR_country_code_059852_str} {590}
\str_const:cn {c_phone_FR_country_code_059853_str} {590}
\str_const:cn {c_phone_FR_country_code_059854_str} {590}
\str_const:cn {c_phone_FR_country_code_059855_str} {594}
\str_const:cn {c_phone_FR_country_code_059856_str} {594}
\str_const:cn {c_phone_FR_country_code_059857_str} {594}
\str_const:cn {c_phone_FR_country_code_059858_str} {594}
\str_const:cn {c_phone_FR_country_code_059859_str} {594}
\str_const:cn {c_phone_FR_country_code_059860_str} {596}
\str_const:cn {c_phone_FR_country_code_059861_str} {596}
\str_const:cn {c_phone_FR_country_code_059862_str} {596}
\str_const:cn {c_phone_FR_country_code_059863_str} {596}
\str_const:cn {c_phone_FR_country_code_059864_str} {596}
\str_const:cn {c_phone_FR_country_code_06_str} {33}
\str_const:cn {c_phone_FR_country_code_0639_str} {262}
\str_const:cn {c_phone_FR_country_code_0690_str} {590}
\str_const:cn {c_phone_FR_country_code_0691_str} {590}
\str_const:cn {c_phone_FR_country_code_0692_str} {262}
\str_const:cn {c_phone_FR_country_code_0693_str} {262}
\str_const:cn {c_phone_FR_country_code_0694_str} {594}
\str_const:cn {c_phone_FR_country_code_0696_str} {596}
\str_const:cn {c_phone_FR_country_code_0697_str} {596}
\str_const:cn {c_phone_FR_country_code_07_str} {33}
\str_const:cn {c_phone_FR_country_code_0700_str} {33}
\str_const:cn {c_phone_FR_country_code_07005_str} {590}
\str_const:cn {c_phone_FR_country_code_07006_str} {594}
\str_const:cn {c_phone_FR_country_code_07007_str} {596}
\str_const:cn {c_phone_FR_country_code_07008_str} {262}
\str_const:cn {c_phone_FR_country_code_07009_str} {262}
\str_const:cn {c_phone_FR_country_code_0708_str} {508}
\str_const:cn {c_phone_FR_country_code_08_str} {33}
\str_const:cn {c_phone_FR_country_code_0901_str} {33}
\str_const:cn {c_phone_FR_country_code_09015_str} {590}
\str_const:cn {c_phone_FR_country_code_09016_str} {594}
\str_const:cn {c_phone_FR_country_code_09017_str} {596}
\str_const:cn {c_phone_FR_country_code_09018_str} {262}
\str_const:cn {c_phone_FR_country_code_09019_str} {262}
\str_const:cn {c_phone_FR_country_code_0937_str} {33}
\str_const:cn {c_phone_FR_country_code_0938_str} {33}
\str_const:cn {c_phone_FR_country_code_0939_str} {33}
\str_const:cn {c_phone_FR_country_code_09395_str} {590}
\str_const:cn {c_phone_FR_country_code_09396_str} {594}
\str_const:cn {c_phone_FR_country_code_09397_str} {596}
\str_const:cn {c_phone_FR_country_code_09398_str} {262}
\str_const:cn {c_phone_FR_country_code_09399_str} {262}
\str_const:cn {c_phone_FR_country_code_09410_str} {33}
\str_const:cn {c_phone_FR_country_code_094700_str} {590}
\str_const:cn {c_phone_FR_country_code_094701_str} {590}
\str_const:cn {c_phone_FR_country_code_094702_str} {594}
\str_const:cn {c_phone_FR_country_code_094703_str} {594}
\str_const:cn {c_phone_FR_country_code_094704_str} {596}
\str_const:cn {c_phone_FR_country_code_094705_str} {596}
\str_const:cn {c_phone_FR_country_code_094706_str} {262}
\str_const:cn {c_phone_FR_country_code_094707_str} {262}
\str_const:cn {c_phone_FR_country_code_094708_str} {262}
\str_const:cn {c_phone_FR_country_code_094709_str} {262}

\tl_const:Nn \c_phone_FR_landesadjektiv_tl {French}
\bool_const:Nn \c_phone_FR_erlaubt_durchwahl_bool {\c_false_bool}

\clist_new:N \c_phone_FR_area_codes_clist
\clist_concat:NNN \c_phone_FR_area_codes_clist \c_phone_FR_geographic_area_codes_clist \c_phone_FR_nongeographic_area_codes_clist

\msg_new:nnn {phonenumbers} {FR/illegal home area code}
   {
      The~only~legal~home~area~code~in~France~is~0508~(Saint-Pierre-et-Miquelon).~#1~cannot~be~set~as~home~area~code~\msg_line_context:.
   }

\msg_new:nnn {phonenumbers} {FR/missing zero}
   {
      French~phone~number~has~no~zero~in~the~beginning~\msg_line_context:
   }

% Prüfe, ob eine Vorwahl als Heimatvorwahl zulässig ist.
% #1: Heimatvorwahl
\prg_new_protected_conditional:Npnn \phone_FR_heimatvorwahl_erlaubt:n #1 {T}
   {
      \clist_if_in:NnTF \c_phone_FR_geographic_area_codes_clist {#1}
         {
            % In Frankreich kann nur 0508 Heimatvorwahl sein.
            \str_if_eq:nnTF {#1} {0508} { \prg_return_true: }
               {
                  \msg_warning:nnn {phonenumbers} {FR/illegal home area code} {#1}
                  \prg_return_false:
               }
         }
         {
            \msg_warning:nnn {phonenumbers} {invalid home area code} {#1}
            \prg_return_false:
         }
   }

% #1: Vorwahl, #2: Rufnummer
\cs_new_protected:Npn \phone_FR_vorwahl_und_rufnummer_schreiben:nn #1#2
   {
      \bool_lazy_or:nnTF { \str_if_eq_p:Vn \l_phone_auslandsvorwahltyp_str {off} } { \str_if_eq_p:Vn \l_phone_heimatland_str {FR} }
         {
            \clist_if_in:NnT \c_phone_FR_nongeographic_area_codes_clist {#1}
               {
                  \str_if_eq:VnT \l_phone_vorwahldarstellung_str {place}
                     {
                        \str_set:Nn \l_phone_vorwahldarstellung_str {number}
                     }
               }

            \bool_lazy_and:nnTF { \str_if_eq_p:Vn \l_phone_heimatland_str {FR} } { \str_if_eq_p:Vn \l_phone_heimatvorwahl_str {#1} }
               {
                   \phone_von_hinten_gruppiert_schreiben:n {#2}   % reine Teilnehmerrufnummer in Saint-Pierre-et-Miquelon
               }
               {
                  \str_case:Vn \l_phone_vorwahldarstellung_str
                     {
                        {number}
                           {
                              \phone_von_vorne_gruppiert_schreiben:V \l_phone_bereinigte_nummer_str
                           }
                        {place}
                           {
                              \tl_if_exist:cTF {c_phone_FR_place_name_ #1 _tl}
                                 {
                                    \tl_put_right:Nv \l_phone_ausgabetext_tl {c_phone_FR_place_name_ #1 _tl}
                                    \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl
                                    \phone_von_vorne_gruppiert_schreiben:n {#2}
                                 }
                                 {
                                    \phone_von_vorne_gruppiert_schreiben:V \l_phone_bereinigte_nummer_str
                                 }
                           }
                        {place-and-number}
                           {
                              \tl_if_exist:cT {c_phone_FR_place_name_ #1 _tl}
                                 {
                                    \tl_put_right:Nv \l_phone_ausgabetext_tl {c_phone_FR_place_name_ #1 _tl}
                                    \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl
                                 }

                              \phone_von_vorne_gruppiert_schreiben:V \l_phone_bereinigte_nummer_str
                           }
                     }
               }
         }
         {
            \phone_gruppierte_auslandsvorwahl_schreiben:v {c_phone_FR_country_code_ #1 _str}

            \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl

            \str_if_eq:nnTF {#1} {0508}   % in Saint-Pierre-et-Miquelon entfällt die Ortsvorwahl
               {
                  \phone_von_hinten_gruppiert_schreiben:n {#2}
               }
               {
                  \phone_von_hinten_gruppiert_schreiben:x { \str_tail:N \l_phone_bereinigte_nummer_str }
               }
         }

      % Linktext schreiben:
      \str_put_right:Nx \l_phone_linktext_str { + \str_use:c {c_phone_FR_country_code_ #1 _str} }
      \str_if_eq:nnF {#1} {0508}   % in Saint-Pierre-et-Miquelon entfällt die Ortsvorwahl
         {
            \str_put_right:Nx \l_phone_linktext_str { \str_tail:n {#1} }
         }
      \str_put_right:Nn \l_phone_linktext_str {#2}
   }

\cs_generate_variant:Nn \phone_FR_vorwahl_und_rufnummer_schreiben:nn {Vx,xx}

\cs_new_protected:Npn \phone_FR_nummer_schreiben:
   {
      \int_set:Nn \l_phone_nummernlaenge_int { \str_count:N \l_phone_bereinigte_nummer_str }

      \int_compare:nNnTF {\l_phone_nummernlaenge_int} < {10}
         {
            \str_if_eq:xnTF { \str_head:N \l_phone_bereinigte_nummer_str } {3}
               {
                  \int_compare:nNnTF {\l_phone_nummernlaenge_int} < {4}
                     {
                        \msg_warning:nnnn {phonenumbers} {number too short} {short} {4}
                        \tl_put_right:NV \l_phone_ausgabetext_tl \l_phone_bereinigte_nummer_str
                     }
                     {
                        \int_compare:nNnTF {\l_phone_nummernlaenge_int} > {4}
                           {
                              \msg_warning:nnnn {phonenumbers} {number too long} {short} {4}
                              \tl_put_right:NV \l_phone_ausgabetext_tl \l_phone_bereinigte_nummer_str
                           }
                           {
                              \phone_von_vorne_gruppiert_schreiben:V \l_phone_bereinigte_nummer_str
                              \str_put_right:NV \l_phone_linktext_str \l_phone_bereinigte_nummer_str
                           }
                     }
               }
               {
                  \msg_warning:nnnn {phonenumbers} {number too short} {phone} {10}
                  \tl_put_right:NV \l_phone_ausgabetext_tl \l_phone_bereinigte_nummer_str
               }
         }
         {
            \bool_lazy_or:nnTF
               {
                  \str_if_eq_p:en { \str_range:Nnn \l_phone_bereinigte_nummer_str {1} {4} } {0700}
               }
               {
                  \str_if_eq_p:en { \str_range:Nnn \l_phone_bereinigte_nummer_str {1} {4} } {0901}
               }
               {
                  \int_compare:nNnTF { \str_item:Nn \l_phone_bereinigte_nummer_str {5} } < {5}
                     {
                        % überlange Nummer (machine to machine) im Mutterland (14 Stellen)
                        \phone_nummernlaenge_ueberpruefen:Vnnn \l_phone_bereinigte_nummer_str {14} {14} {machine~to~machine}
                        \bool_if:NTF \l_phone_teilnehmerrufnummer_gueltig_bool
                           {
                              \phone_FR_vorwahl_und_rufnummer_schreiben:xx
                                 {
                                    \str_range:Nnn \l_phone_bereinigte_nummer_str {1} {4}
                                 }
                                 {
                                    \str_range:Nnn \l_phone_bereinigte_nummer_str {5} {-1}
                                 }
                           }
                           {
                              \tl_put_right:NV \l_phone_ausgabetext_tl \l_phone_bereinigte_nummer_str
                           }
                     }
                     {
                        % überlange Nummer (machine to machine) in den Überseegebieten (13 Stellen)
                        \phone_nummernlaenge_ueberpruefen:Vnnn \l_phone_bereinigte_nummer_str {13} {13} {machine~to~machine}
                        \bool_if:NTF \l_phone_teilnehmerrufnummer_gueltig_bool
                           {
                              \phone_FR_vorwahl_und_rufnummer_schreiben:xx
                                 {
                                    \str_range:Nnn \l_phone_bereinigte_nummer_str {1} {5}
                                 }
                                 {
                                    \str_range:Nnn \l_phone_bereinigte_nummer_str {6} {-1}
                                 }
                           }
                           {
                              \tl_put_right:NV \l_phone_ausgabetext_tl \l_phone_bereinigte_nummer_str
                           }
                     }
               }
               {
                  \int_compare:nNnTF {\l_phone_nummernlaenge_int} > {10}
                     {
                        \msg_warning:nnnn {phonenumbers} {number too long} {phone} {10}
                        \tl_put_right:NV \l_phone_ausgabetext_tl \l_phone_bereinigte_nummer_str
                     }
                     {
                        \str_if_eq:xnTF { \str_head:N \l_phone_bereinigte_nummer_str } {0}
                           {
                              \bool_set_false:N \l_phone_vorwahl_gefunden_bool

                              \int_step_inline:nnnn {6} {-1} {2}
                                 {
                                    \bool_if:NF \l_phone_vorwahl_gefunden_bool
                                       {
                                          \int_compare:nT { \l_phone_nummernlaenge_int >= ##1 }
                                             {
                                                \str_set:Nx \l_tmpa_str { \str_range:Nnn \l_phone_bereinigte_nummer_str {1} {##1} }

                                                \clist_if_in:NVT \c_phone_FR_area_codes_clist \l_tmpa_str
                                                   {
                                                      \bool_set_true:N \l_phone_vorwahl_gefunden_bool
                                                      \phone_FR_vorwahl_und_rufnummer_schreiben:Vx \l_tmpa_str
                                                         {
                                                            \str_range:Nnn \l_phone_bereinigte_nummer_str {##1 + 1} {-1}
                                                         }
                                                   }
                                             }
                                       }
                                 }

                              \bool_if:NF \l_phone_vorwahl_gefunden_bool
                                 {
                                    \msg_warning:nn {phonenumbers} {invalid area code}
                                    \tl_put_right:NV \l_phone_ausgabetext_tl \l_phone_bereinigte_nummer_str
                                 }
                           }
                           {
                              \msg_warning:nn {phonenumbers} {FR/missing zero}
                              \tl_put_right:NV \l_phone_ausgabetext_tl \l_phone_bereinigte_nummer_str
                           }
                     }
               }
         }
   }

\cs_new_protected:Npn \phone_FR_vorwahlliste_ausgeben:n #1
   {
      \begin{tabbing}
      \hspace {4em} \= \kill

      \bool_set_false:N \l_phone_zeilenumbruch_bool

      \clist_map_inline:cn {c_phone_FR_ #1 _clist}
         {
            \bool_if:NTF \l_phone_zeilenumbruch_bool
               {
                  \\
               }
               {
                  \bool_gset_true:N \l_phone_zeilenumbruch_bool
               }

            \phone_von_vorne_gruppiert_schreiben:n {##1}
            \tl_use:N \l_phone_ausgabetext_tl
            \>
            \tl_if_exist:cT {c_phone_FR_place_name_ ##1 _tl}
               {
                  \tl_use:c {c_phone_FR_place_name_ ##1 _tl}
               }
         }
      \end{tabbing}
   }
