قالب:ISO 15924 direction

Template documentation[view] [edit] [history] [purge]

Usage

The template returns, for an ISO script code, the direction rtl, ltr, mixed, <blank>.

Options

The output texts rtl, ltr, mixed, <blank> can be altered:

  • {{ISO 15924 direction|Mang|ltr=left-to-right|rtl=right-to-left|mixed=both directions|default=unknown}} → unknown
  • {{ISO 15924 direction|Zyyy|ltr=left-to-right|rtl=right-to-left|mixed=both directions|default=unknown}} → both directions

How is it determined

The direction is determined as follows.

  • First, if a script is present in Unicode, Unicode Bidi-direction is derived for that Unicode script.

There are 94 scripts in Unicode (those ISO codes that have an alias). All regular scripts have a single "Strong" in Unicode direction. That is, all characters in a Unicode script that are "Strong", have the same directionality: either right-to-left (rtl) or left-to-right (ltr). Within a script there are no opposing directions present. There can be characters with "Weak" or "Neutral" direction (i.e., direction through context), but these do not alter other characters diretionality. One exception: script "Zyyy" conatains characters with either direction. Therefor, Zyyy has direction "mixed".

  • Second, all other scripts, that are not defined in Unicode, can have their direction set manually in this template.

How to add a script direction

The Unicode scripts are determined as of version 6.0, and should be complete & correct. That (upper) part of the list should not be changed unless for errors. An script directionality can be added:

 | <!--
end of Unicode-determined -->
 | Abcd
 | Defg = {{{ltr|ltr}}
 | Pqrs
 | Tuvw = {{{rtl|rtl}}
 | #default={{{default|}}}

The parameters as shown keep the output text option available.

Background

For scripts in Unicode, the direction is determined as follows. Each character in a script (say Hebr) has a single property bidi-type. The value of that bidi-type is from a list, and its usage is described in the Unicode Bidi Algorithm (UAX#9).

The bidi-type can determine the direction, which can be a Strong, Neutral or Weak one. Strong directions are independent, like for the Latin alphabet A-Z. Neutral and Weak directions are dependent on context (think nearby other characters), and are used e.g. with decimals, diacritics and punctuation marks.

Within the character set of a script (e.g. Hebr=Hebrew script has 133 characters in Unicode), there are Strong characters, all are right-to-left. Other characters are Neutral, and so have not direction by their own. This is true for all (but one) scripts in Unicode: withingn a script, all Strong directions are the same.

From there this templates is build: All scripts in Unicode (but one exception, see below) have a single Strong direction. That direction is used here in this template. The exception is: Zyyy, Common, which is a collection of various characters that can be of either direction.

See also

General information on ISO 15924 templates

   This section:  view • edit 

Overview

ISO 15924Unicode – Wikidata – enwiki: Overview templates & properties
Item In template /subs Content Example Publisher Usage TPU Note
Code (ISO) {{ISO 15924 code}} /subp ID Arab ISO 15924 Everywhere [TPU] Alpha-4, enwiki central ISO script id list
Alias (Unicode) {{ISO 15924 alias}} /subp ID Arabic Unicode [TPU]
Article (enwiki) {{ISO 15924/wp-article}} /subp ID [[Arabic script]] enwiki [TPU]
QID (wikidata) {{ISO 15924/qid}} /subp ID Q790681 Wikidata [TPU]
Number; range 000–999 {{ISO 15924 number}} /subp ID 234 ISO 15924 rarely [TPU] ISO number not used as ID in enwiki; see Code
Scripts (sub)merged into main scripts
{{ISO 15924 alias/unicode-merged-into-script}} /subp Merged scripts Latf → Latn Unicode Script descriptions, re U+ [TPU] In mainspace: 10× hardcoded (e.g.); 2× Qxxx depr
Name {{ISO 15924 name}} /subp data Deseret (Mormon) ISO 15924 [TPU]
Unicode chapter {{ISO 15924/unicode-chapter}} /subp data قالب:ISO 15924/unicode-chapter/format Unicode [TPU] pdf does not open at .n subchapter
Script example
character
{{ISO 15924/script-example-character}} /subp data ع enwiki User boxes [TPU]
In Mainspace
Overview
  • ISO
  • U
  • enwiki
{{ISO 15924 script codes and related Unicode data}} /subp list enwiki ISO 15924 [TPU] Mainspace: ISO 15924, Script (Unicode), Unicode character property
Blocks ⇄ Scripts {{Unicode blocks}} /subp list enwiki some script articles [TPU] Mainspace; related
graphs {{ISO 15924/unicode-script-illustration}} /subp fonts&files [TPU] Mainspace, Scripts in Unicode
Overviews
Overview: templates {{ISO 15924/overview-templates}} /subp list Wikipedia [TPU]
WP-category {{ISO 15924/wp-category}} /subp data Category:Arabic script enwiki Not checked for mainspace [TPU] watered down concept for minor scripts
Also (doc, userbox, technical, ...)
Documentation {{ISO 15924 templates/doc}} /subp prime documentation Latin script in Unicode (~) [TPU] Reused in multiple templates
Redirect {{R from ISO 15924 code}} /subp template enwiki Redirects [TPU]
userbox {{User iso15924}} /subp Userboxes [TPU]
Related Changes {{Recent changes in Unicode}} /subp pages Unicode, ISO 15924 WP:RELC Related Changes enwiki WikiProject [TPU] 900+700 P x T
Unicode versions {{Unicode version}} /subp Version number as of Unicode version 13.0 enwiki [TPU] (new Sep2022)
Wikidata properties
Directionality P1406 {{Infobox}}, ...
Unicode ranges P5949 {{Infobox}}, ...
ISO English name P2561 Crosscheck only
Modules
Data module module:Unicode data /subp § Functions_overview
HTML named entities module:Numcr2namecr /subp

ISO updates

  • The ISO 15924 list of script codes is updated regularly, usually at least once a year. The current list is complete اعتبارا من 24 أبريل 2025 (2025-04-24), and defines 226 codes (code, number, script name).
  • اعتبارا من 25 April 2025, this template contains 274 ISO 15924 script codes. All are paired in both forms Xxxx and 123 (Alpha-4 and numerical). This 274 includes 50 distinct Qxxx codes. Some ISO-defined codes may have no ISO name, and/or may not be Unicode-defined.

References

  • "ISO 15924". Unicode Consortium.
  • "ISO 15924 Code lists". Unicode Consortium.
  • "ISO 15924 code changes". Unicode Consortium. 2021-12-03.
  • "Unicode TR24 Script property". Unicode Consortium. 2022-04-29.