本文へ移動

Kuni国

国、コード、名前、行政区画を調べ、必要なときに国のデータを読み込み、標準の国のカードを表示できます。

「国(くに)」は、国を表す日本語です。 名前について(英語)

目次

変更履歴

この変更履歴はまだ日本語に訳されていないため、英語で表示しています。

All notable changes to this project are written here. The format follows Keep a Changelog, and the project uses Semantic Versioning.

[Unreleased]

[1.4.0] - 2026-10-14

A country and subdivision card with a shared embed builder joins the demo and the package, tables download as Markdown and SQL, and the package has an English and Japanese documentation site with a checked example for every export. The country data, the codes and the lookups are unchanged.

Added

  • Add the bilingual documentation site, checked public examples, full country-resource catalogue, local search and machine-readable pages.
  • Add a country and subdivision card, embed builder and validated storage-free iframe.
  • Add per-place colours and a capital-marker switch to country cards and their builder/frame links. Hosts can receive drawing options in map loaders; capital text fields stay separate.
  • Share a package-independent embed builder for option controls, preview adapters, code tabs and shareable links.

Changed

  • The tests allow thirty seconds each (vitest.config.js), because the shared test that measures each entry point's size builds the country data and took longer than five seconds on a slow runner.
  • The API link in the header reads "API" in English, so that the header takes the same number of rows in English and in Japanese on a phone, as the demo's test of a language change asks.
  • Synchronize documentation tooling for repository layouts, generated type references, Node entry points and repository-specific README links.
  • Keep complete resource catalogues on the documentation entry index and the active resource beside core navigation; render valid default imports in HTML and Markdown.
  • Reconcile cards with the released IOC/withdrawn APIs; append optional ioc display while keeping current-country pickers and default fields unchanged.
  • Compose optional Hata flags and Chizu maps, retain dated facts and land-area scope, and expose reflected properties and native load/error events.
  • Group the package family by kind, alphabetize each group, and include the geography packages and REST in Pieces in the shared footer and README.
  • Update the shared family description for addresses in all seven supported countries, including France and Germany.

[1.3.0] - 2026-10-09

Added

  • country(code).ioc, the International Olympic Committee's three-letter country code ("JPN", "GER" for Germany, "SUI" for Switzerland, "TPE" for Taiwan, "KOS" for Kosovo), for the 209 countries Wikidata (P984, CC0) gives one. A country with none has no ioc field. It is one more column in the main entry's table: the entry grew by 1.7 KB (0.8 KB gzipped).
  • @johnmorrisdotca/kuni/withdrawn, a new entry: the 31 countries ISO 3166-3 lists as withdrawn from ISO 3166-1, with withdrawnCountries() and withdrawn(code). A record has the four-letter code (SUHH), the alpha-2 (SU), alpha-3 (SUN) and numeric (810) codes it held, its name in English and Japanese, since and until (the years the code was in force), the successors (the new codes ISO 3166-3 lists, in ISO's order; every record has at least one, and one may itself be withdrawn: Yugoslavia's is CS, which withdrawn("CS") resolves to Serbia and Montenegro first and Czechoslovakia after) and reusedBy where a current country holds the alpha-2 code now (BY, AI, BQ, GE, SK). The lookup takes any of the four codes in either case and answers every country that held it, the last one first (withdrawn("CS") is Serbia and Montenegro, then Czechoslovakia), and an empty list for anything else. The Soviet Union, Yugoslavia, Czechoslovakia, East Germany, Zaire, East Timor, the Netherlands Antilles and Burma are among them. The main entry is unchanged: countries() and country() never return one, so no country picker shows the USSR. It is 8 KB (2.4 KB gzipped).
  • ISO 3166-3 is the authority for the withdrawn countries' codes, years and successors: WITHDRAWN_TABLE in scripts/withdrawn-config.ts is the published list transcribed once (alpha-3, numeric, the years the code was in force, ISO's new codes), and src/withdrawn.test.ts pins the whole table, so a rebuild cannot drift from it. Wikidata is used for their names (English and Japanese) and for the IOC codes: a new snapshot, data-sources/wikidata-codes-2026-10-10.json, read by pnpm data:codes (CC0), turned into records by scripts/withdrawn.ts, which stops if the snapshot and ISO's table do not name the same 31 codes. docs/withdrawn.md lists every record and the Japanese names for review. The names, facts and groupings snapshots are unchanged.
  • NOTICE.md, data-sources/README.md and the README's data table say where the new data comes from and its terms.

Changed

  • Country has a new optional field, ioc. The table the main entry reads has one more column before the user-assigned marker; nothing that reads country() changes.

[1.2.0] - 2026-10-09

Added

  • The demo's Compare view colours each country on its own: a colour picker for each outline (the family's green and red at first, never the same), and a "Show capitals" switch for the dot on each capital. Both are kept in the address (#/compare/JP/GB?colours=2f5d4a,b5452c&capitals=off), so a shared link shows what its sender saw, and swapping the countries takes each one's colour with it.
  • The demo's tables and lists also download as a Markdown table and as SQL, beside CSV, JSON and text. The Markdown is a GitHub table (a | in a cell is escaped, a line break is <br>); the SQL is a CREATE TABLE and an INSERT a row, with double-quoted names, single-quoted text and NULL for what is missing, and runs in SQLite, PostgreSQL and MySQL (MySQL needs ANSI_QUOTES and NO_BACKSLASH_ESCAPES, which the file's second line says). The writers are demo/downloads.js, the same file in kuni, chizu and hata, held to one hash and tested by loading the SQL into SQLite.

Fixed

  • On a phone, Compare's table no longer squeezes a long label into one character a line or cuts off the second country: each fact is a block, its name above the two countries' values and the difference under them.

[1.1.0] - 2026-10-09

Added

  • Each country's capital in Japanese: country(code).capital is now { en, ja } (東京, キーウ), from Wikidata, for all 245 countries that have a capital.
  • @johnmorrisdotca/kuni/facts, a new entry so the main one stays small: for every country its population and area with the year each is for, the coordinates of the country and of its capital, the countries it shares a land border with ([] for an island), the side of the road it drives on, and CLDR's first day of the week, measurement system, paper size and clock. facts(code), allFacts(), distanceKm(from, to) and FACTS_READ, the day Wikidata was read. Plain numbers and codes, for a build script to read as they are.
  • @johnmorrisdotca/kuni/subdivision-facts and /subdivision-facts/<code>: each subdivision's capital (in English and Japanese, with a reading in kana for Japan's prefectural capitals), population, area and coordinates, one country at a time, with loadSubdivisionFacts(code). Complete for Japan's 47 prefectures.
  • @johnmorrisdotca/kuni/groupings: 107 groupings, each named in English and Japanese with its members, definition, source, licence and the day it was true. The seven continents; the 30 UN M49 areas; 23 international bodies (the UN, the EU with its candidates, the euro area, Schengen, the EEA, NATO, the G7 and G20, the OECD, ASEAN, the African Union, the Arab League, the GCC, the Commonwealth, OPEC, BRICS, Mercosur, the USMCA, APEC, CARICOM, the Pacific Islands Forum, the Nordic Council and Benelux) with the days members joined and left; 16 informal groupings (the Middle East, Latin America, the Caribbean, the Balkans, the Western Balkans, Scandinavia, the Nordic countries, the Baltic states, Central and Southeast Asia, the Maghreb, the Horn of Africa, the Sahel, the British Isles, Iberia, Asia-Pacific); and regions inside a country (Japan's eight 地方 and the nine-region variant, the US Census regions and divisions, Canada's five regions, the UK's four nations, Australia's states and territories). groupings, grouping, groupingsOf and membersOf, with on for a body's members on a past day.
  • Every public export has a doc comment, kept in the built .d.ts so an editor shows it, with @param, @returns and an example; the tests run every example. The API page shows each function's parameters, what it returns and its example, and each interface's fields.
  • Japan's Kinki region carries Kansai (関西地方) as its other name: Grouping.otherNames.
  • docs/facts.md, docs/subdivision-facts.md and docs/groupings.md say what was decided, how much is known, and why the rest is null.
  • The demo has views of its own, each at its own address: a page for each country (its outline from Chizu with the capital marked, its facts with their years, neighbours and groupings as links, furigana, the time now in each of its zones), two countries compared, every country in a table to filter, sort and narrow by grouping, a groupings explorer with a body's members on any day, three seeded quizzes (capitals, which country a region is in, calling codes) whose link gives the same questions, a country and region form widget in English or Japanese with its code to copy, search by calling code, currency or domain, and the data's quality in the open. Tables and lists download as CSV, JSON or text. Chizu is a development dependency for the demo's outlines only.

Changed

  • Equatorial Guinea's capital is Ciudad de la Paz (シウダ・デ・ラ・パス), where it moved in January 2026; it was Malabo.
  • Continents follow UN M49 (from CLDR): Russia is in Europe, Cyprus in Asia, Timor-Leste in Asia, Christmas Island and the Cocos Islands in Oceania, the British Indian Ocean Territory in Africa, and the sub-Antarctic islands where M49 puts them (Bouvet Island and South Georgia in South America, Heard and McDonald in Oceania, the French Southern Lands in Africa). Antarctica is the one continent named by hand. 1.0.0 took the continent from countries-list.
  • Norway's counties are those of 2024, when Viken, Vestfold og Telemark and Troms og Finnmark were divided again: NO-31 Østfold, NO-32 Akershus, NO-33 Buskerud, NO-39 Vestfold, NO-40 Telemark, NO-55 Troms and NO-56 Finnmark are added and NO-30, NO-38 and NO-54 are gone, as in ISO 3166-2, which CLDR 48.2 has not caught up with. There are now 5,050 subdivisions.
  • Short names where CLDR's full name reads badly in a narrow space: DR Congo (コンゴ民主共和国) and Congo (コンゴ共和国) for "Congo - Kinshasa" and "Congo - Brazzaville", ミャンマー for ミャンマー (ビルマ), ココス諸島. Hong Kong, Macao and Myanmar already had CLDR's.
  • Each capital's Japanese name is the usual one (東京, 北京, ソウル), not a municipality's formal name, after a review.

Fixed

  • English subdivision names that were wrong in 1.0.0: Peterborough and Marlborough were cut short ("Peter", "Marl"); Chiayi City and Chiayi County were swapped, in Japanese too (嘉義市, 嘉義県); Bogotá was "Capital District"; Davao de Oro (ダバオ・デ・オロ州), Csongrád-Csanád and Nicaragua's two Caribbean Coast regions had their old names; Russia's republics Buryatia, Chechnya, Chuvashia, Kabardino-Balkaria, Karachay-Cherkessia and Udmurtia were adjectives, and Altai Republic and Komi Republic are told from their neighbours; Cần Thơ had lost its marks; Barisal Division and Barisal District had each other's names; and Morocco's twelve regions carried the names of the regions that held their codes before 2019 (MA-04 is Rabat-Salé-Kénitra, not Oriental), in Japanese too, where MA-11's came from a Wikidata label that was not a name. Every English name is now checked for each of these faults against Wikidata's English label, and the build stops on one nobody has decided (docs/disagreements.md).

[1.0.0] - 2026-10-09

The first version: every country and its subdivisions, with ISO 3166 codes and names in English and Japanese.

Added

  • @johnmorrisdotca/kuni: the 250 countries (the 249 ISO 3166-1 codes and Kosovo, XK, as a user-assigned code), each with alpha-2, alpha-3 and numeric codes, its name in English and Japanese from Unicode CLDR 48.2, CLDR's short and variant forms, its own name, a reading in hiragana for a Japanese name written in kanji, its flag, continent and UN M49 subregion, calling code, currencies, top-level domain, capital, IANA time zones, languages and the kind of place its subdivisions are. Lookups: country (alpha-2 in either case, alpha-3 or numeric), countries (in code, English or Japanese order), countryByName (a name in either language, a short name, the country's own name or an alias such as Holland, UK, Burma or 米国), countryName, flag, continentName, subregionName, fold and isCountryCode.
  • /codes: the 250 codes alone, COUNTRY_CODES, isCountryCode and the CountryCode type, about 2 KB.
  • /subdivisions/<code>: one country's subdivisions as a list, one entry for each of the 200 countries that have them (Japan's 47 prefectures are under 3 KB).
  • /subdivisions: all 5,046 ISO 3166-2 subdivisions (3,590 at the first level, the rest below it, such as France's departments inside its regions), each with its code, short code, level, parent, kind of place, English name, Japanese name or null, and for Japan's prefectures a reading. Lookups: subdivisions (by level), allSubdivisions, subdivision, subdivisionByShortCode, subdivisionByName and subdivisionsByName (English or Japanese, with or without the word for its kind, オンタリオ for オンタリオ州), and subdivisionTypeLabel (都, 道, 府 and 県 for Japan; 州 for Canada's provinces).
  • /load: loadSubdivisions(code), one dynamic import for each country, so a page loads only the countries somebody picks.
  • Japanese names for 3,523 of the 3,590 first-level subdivisions (3,387 from CLDR, 41 written by hand where CLDR's is wrong or out of date, 95 from Wikidata where CLDR has none) and 4,747 of all 5,046; the rest are null, never an English name copied in. CLDR's trailing brackets that tell a place from one of the same name elsewhere (セント・ポール (ドミニカ国), バリンゴ (カウンティ), 江原道 (北)) are taken off, 115 of them, and listed in docs/name-rules.md. The 46 hand-written names (JA_NAME_OVERRIDES: parishes as 教区, Ukraine's Japanese forms of 2022, places renamed since, Latvian spellings and others) are listed with their reasons in docs/disagreements.md, with the questions left for a native reader of Japanese. docs/ja-gaps.md lists the gaps.
  • ESM and CommonJS builds with types for both, sideEffects: false, no runtime dependencies, and no use of Intl, so a server and a browser give the same names.
  • pnpm data builds the data from inputs committed under data-sources/ (CLDR's subdivision files, IANA's zone.tab and TLD list, a Wikidata snapshot), checked by SHA-256, with no network; pnpm data:fetch and pnpm data:wikidata refresh them.
  • A demo with three panels (find a country, the subdivisions of a country, look up a code) in English and Japanese, an API reference page, browser tests at a phone's width and a desk's, and the README's pictures taken from it.

ソースを見るGitHub で編集@johnmorrisdotca/kuni 1.4.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。