Skip to content

Commit

Permalink
Add extra languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Jul 30, 2024
1 parent 88a78c6 commit c9bbc77
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 6 deletions.
16 changes: 12 additions & 4 deletions images/tiler-server/build_config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import os
import re
import argparse

# Argument parser setup
parser = argparse.ArgumentParser(description='Merge TOML files into a configuration file.')
parser.add_argument('--template', default='config/config.template.toml', help='Path to the configuration template file.')
parser.add_argument('--providers', default='config/providers', help='Directory containing provider TOML files.')
parser.add_argument('--languages', default='config/lenguages.sql', help='Path to the languages SQL file.')
parser.add_argument('--languages', default='config/languages.sql', help='Path to the languages SQL file.')
parser.add_argument('--output', default='config/config.toml', help='Output configuration file path.')
args = parser.parse_args()

Expand All @@ -12,9 +15,14 @@
languages_file = args.languages
output_file_path = args.output

# Read the content of lenguages.sql
def remove_comments_from_languages_content(content):
# Remove comments (lines starting with '--')
return '\n'.join(line for line in content.split('\n') if not line.strip().startswith('--'))

# Read the content of languages.sql and remove comments
with open(languages_file, "r") as file:
languages_content = file.read().strip()
languages_content = remove_comments_from_languages_content(languages_content)

toml_files = [file for file in os.listdir(providers_dir) if file.endswith(".toml")]

Expand Down Expand Up @@ -49,8 +57,8 @@
preceding_newline = content.rfind('\n', 0, indentation_level)
indentation = content[preceding_newline + 1:indentation_level]
toml_file_content = f"###### From {toml_file} \n" + toml_file_content
new_values=toml_file_content.replace("\n", "\n" + indentation)
new_values = toml_file_content.replace("\n", "\n" + indentation)
content = content.replace(section_header, new_values)

with open(output_file_path, "w") as output_file:
output_file.write(content)
output_file.write(content)
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- Multilingual_names from OSM
tags -> 'name:aaq' AS name_aaq,
tags -> 'name:ab' AS name_ab,
tags -> 'name:abe' AS name_abe,
Expand Down Expand Up @@ -170,7 +171,6 @@ tags -> 'name:la' AS name_la,
tags -> 'name:lad' AS name_lad,
tags -> 'name:lb' AS name_lb,
tags -> 'name:lbe' AS name_lbe,
tags -> 'name:left' AS name_left,
tags -> 'name:lez' AS name_lez,
tags -> 'name:lfn' AS name_lfn,
tags -> 'name:lg' AS name_lg,
Expand Down Expand Up @@ -356,4 +356,56 @@ tags -> 'name:zgh' AS name_zgh,
tags -> 'name:zh' AS name_zh,
tags -> 'name:zu' AS name_zu,
tags -> 'name:zza' AS name_zza,
tags -> 'name:nds_nl' AS name_nds_nl
tags -> 'name:nds_nl' AS name_nds_nl,
-- Extra languages
tags -> 'name:ko-Hani' AS name_ko_hani,
tags -> 'name:sr-Latn' AS name_sr_latn,
tags -> 'name:vi-Hani' AS name_vi_hani,
tags -> 'name:zh-Hans' AS name_zh_hans,
tags -> 'name:zh-Hant' AS name_zh_hant,
-- Modern languages
tags -> 'name:sme' AS name_sme,
tags -> 'name:bua' AS name_bua,
tags -> 'name:old' AS name_old,
tags -> 'name:ale' AS name_ale,
tags -> 'name:be-tarask' AS name_be_tarask,
tags -> 'name:tpi' AS name_tpi,
tags -> 'name:tzm' AS name_tzm,
tags -> 'name:cst' AS name_cst,
tags -> 'name:tli' AS name_tli,
tags -> 'name:lut' AS name_lut,
tags -> 'name:pes' AS name_pes,
tags -> 'name:hyw' AS name_hyw,
tags -> 'name:hye' AS name_hye,
tags -> 'name:jam' AS name_jam,
tags -> 'name:int' AS name_int,
tags -> 'name:ksb' AS name_ksb,
tags -> 'name:chn' AS name_chn,
tags -> 'name:evn' AS name_evn,
tags -> 'name:yrk' AS name_yrk,
tags -> 'name:rif' AS name_rif,
--Historical languages
tags -> 'name:egy' AS name_egy,
tags -> 'name:sux' AS name_sux,
tags -> 'name:orv' AS name_orv,
tags -> 'name:akk' AS name_akk,
tags -> 'name:mkh-x-mvi' AS name_mkh_x_mvi,
tags -> 'name:cop' AS name_cop,
tags -> 'name:xaa' AS name_xaa,
tags -> 'name:peo' AS name_peo,
tags -> 'name:phn' AS name_phn,
tags -> 'name:zkg' AS name_zkg,
tags -> 'name:gez' AS name_gez,
tags -> 'name:otk' AS name_otk,
tags -> 'name:prg' AS name_prg,
tags -> 'name:mga' AS name_mga,
tags -> 'name:hit' AS name_hit,
tags -> 'name:mxi' AS name_mxi,
tags -> 'name:elx' AS name_elx,
tags -> 'name:xib' AS name_xib,
tags -> 'name:xpu' AS name_xpu,
tags -> 'name:xng' AS name_xng,
tags -> 'name:txg' AS name_txg,
tags -> 'name:okm' AS name_okm,
tags -> 'name:pal' AS name_pal,
tags -> 'name:nci' AS name_nci

0 comments on commit c9bbc77

Please sign in to comment.