This repository has been archived by the owner on Mar 9, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
added iso_639_leecher
git-svn-id: svn://78.47.249.61/ruby-mediawiki/trunk@48 ba9c31aa-a806-0410-9a81-9f13d15ee83b
- Loading branch information
sven
committed
Apr 1, 2006
1 parent
066aba0
commit bd06190
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,41 @@ | |||
#!/usr/bin/env ruby | |||
|
|||
$:.unshift('../lib') | |||
|
|||
require 'mediawiki/dotfile' | |||
require 'mediawiki/table' | |||
require 'momomoto/momomoto' | |||
require 'momomoto/tables' | |||
require 'momomoto/bot_login' | |||
|
|||
ENV['MEDIAWIKI_WIKI'] = 'wikipedia_de' | |||
|
|||
db_config = YAML.load_file('db_config.yml')['development'] | |||
Momomoto::Base.connect(db_config) | |||
Momomoto::Bot_login.authorize('ui_tagger') | |||
|
|||
wiki = MediaWiki.dotfile | |||
page = wiki.article('ISO 639', 3) | |||
t = MediaWiki::Table.parse( page.text ) | |||
|
|||
t.shift | |||
|
|||
t.each do | row | | |||
row[2].split( '/' ).each do | iso_code | | |||
id = Momomoto::Language.find({:iso_639_code=>iso_code}) | |||
next unless id.length == 1 | |||
match = row[0].match /\[\[(.*\|)?(.+)\]\]/ | |||
name = match[2] | |||
|
|||
local = Momomoto::Language_localized.find({:language_id=>id.language_id,:translated_id=>144}) | |||
if local.length == 0 && name != '' | |||
local.create | |||
local.language_id = id.language_id | |||
local.translated_id = 144 | |||
local.name = name | |||
local.write | |||
end | |||
|
|||
end | |||
end | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters