link_replace is a tool written in Ruby language that aims to decrease the time required to perform the translation of an article.

The most tedious and time-consuming part of translating an article is probably to find the appropriate article titles in the target language for all the links inside the article that we want to translate. The tool automatically opens all links of an article or text, looks for their interwiki link to the target language and perform all the necessary substitutions.

Usage

edit

$ ruby link_replace.rb from_language to_language [article_name]

Example

edit

Directly from Wikipedia

edit

$ ruby link_replace.rb en fr Japan

Would fetch Japan from en.wikipedia.org and replace all the article links with the appropriate link for the french wikipedia.

Caution: The tool performs an HTTP query for all links. That is why it is recommended to use the following method and split articles with numerous links into several parts.

Copy/Paste

edit

$ cat | ruby link_replace en fr

Tokyo is known for its many museums. Located in [[Ueno Park]] are the [[Tokyo National Museum]], the country's largest museum and specializing in traditional [[Japanese art]]; the National Museum of Western Art; and the Tokyo Metropolitan Art Museum, which contains collections of Japanese [[modern art]] as well as over 10,000 Japanese and foreign films.
^D

Enter the command, paste your text and press ctrl+D (which ^D means).

The program will output:


Ueno_Park: interwiki link to fr found (Parc de Ueno)
Tokyo_National_Museum: interwiki link to fr found (Musée national de Tōkyō)
Japanese_art: interwiki link to fr found (Art japonais)
modern_art: interwiki link to fr found (Art moderne)


Tokyo is known for its many museums. Located in [[Parc de Ueno]] are the [[Musée national de Tōkyō]], the country's largest museum and specializing in traditional [[Art japonais]]; the National Museum of Western Art; and the Tokyo Metropolitan Art Museum, which contains collections of Japanese [[Art moderne]] as well as over 10,000 Japanese and foreign films.

Download

edit

http://www.mblondel.org/files/link_replace.rb