Cldr v0.0.4 Cldr.Downloader

Downloads the CLDR repositoey from the Unicode consortium.

The files are downloaded ./data directory, unzipped and converted to JSON.

Summary

Functions

Adds the data directory to the .gitignore file of the project if it does not exist

Converts the CLDR repository from XML to JSON using the Unicode java-based utility ldml2json

Downloads the CLDR repository files

Uses wget to retrieve the latest version of the CLDR repository and stores it in the ./data directory

Functions

add_dir_to_gitignore(destination_dir)

Adds the data directory to the .gitignore file of the project if it does not exist.

  • destination_dir is the name of the data dir, ./data
convert_to_json(download_dir, destination_dir)

Converts the CLDR repository from XML to JSON using the Unicode java-based utility ldml2json.

  • download_dir is the location of the downloaded repository

  • destination_dir is the destination for the converted files
download(base_url, required_files, destination_dir)

Downloads the CLDR repository files.

One task for per file is created which then fetches the file and unzips it. This strategy works because there are less than 5 files to be downloaded.

  • base_url is the URL of the Unicode CLDR server

  • required_files is a list of the files to be downloaded

  • destination_dir is the directory of the download destination
ensure(error, dir)
fetch_and_unzip_file(download_url, destination_dir, file)

Uses wget to retrieve the latest version of the CLDR repository and stores it in the ./data directory.

  • download_url is the url of the Unicode CLDR repository

  • destination_dir is the location to store the file. Usually ./data

  • file is the name of the file to be downloaded from the server
remove_package_files(data_dir)