GithubHelp home page GithubHelp logo

strainu / wlm-iso-3166-2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from awjrichards-zz/wlm-iso-3166-2

1.0 3.0 0.0 682 KB

ISO-3166-2 translations and translation scripts for the Wiki Loves Monuments API

PHP 100.00%

wlm-iso-3166-2's Introduction

WLM-ISO-3166-2

This repo contains ISO-3166-2 translations and translation scripts for the Wiki Loves Monuments (WLM) API. This is a project specifically to provide translations to ISO-3166-2 data for the WLM mobile app (wikimedia/WLMMobile)

How it works

ISO-3166-2 data is taken from a CSV dump from commondatahub.com. The csv gets processed into a file containing a PHP array in this format:

$subdivisions[<country iso code>][<subdivision iso code>] = array(
'name' => <subdivision name>,
'level' => <subdivision level>
);

The CSV is stored in this repo and the file can be generated with parseIso3166-2Dump.php. This file can optionally check subdivision names against English Wikipedia article titles, using redirects from the ISO-3166-2 subdivision name in the CSV to the 'standard' Wikipedia article title to choose what name to use for the subdivision.

The iso3166-2-l10n.php script will take the mappings generated above, and foreach subdivision name, attempt to find a translation using English Wikipedia's interwiki language links. That is, it will query Wiipedia's API for a title (mapped to a subdivision name) and look for article titles mapped in other languages, and use those titles as subdivision names for that language. It will generate language-specific files containing the same PHP array as above, with the subdivision name localized.

Caveats

This is far from perfect. At the moment, it only attempts to perform translations for countries/languages that are being used by the WLM app. Also, as you can imagine, there are many potential problems with relying on Wikipedia page titles for translatons. But it's a cheap, quick, and dirty way to get translated ISO-3166-2 data in a free, open, and mashed up manner!

wlm-iso-3166-2's People

Contributors

awjrichards-zz avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.