up translated pages
This commit is contained in:
parent
48b8683028
commit
8008e0291e
4 changed files with 85 additions and 12 deletions
|
@ -162,8 +162,23 @@ def save_to_json(data, filename):
|
|||
filename (str): Name of the file
|
||||
"""
|
||||
try:
|
||||
# Convert data to JSON string
|
||||
json_str = json.dumps(data, indent=2, ensure_ascii=False)
|
||||
|
||||
# Print the JSON string for debugging
|
||||
logger.info(f"JSON string to be written to {filename}:")
|
||||
logger.info(f"JSON keys at top level: {list(data.keys())}")
|
||||
if 'translations' in data:
|
||||
logger.info(f"JSON keys in translations: {list(data['translations'].keys())}")
|
||||
if 'type' in data['translations']:
|
||||
logger.info(f"'type' key exists in translations")
|
||||
if 'type_key' in data['translations']:
|
||||
logger.info(f"'type_key' key exists in translations")
|
||||
|
||||
# Write the JSON string to the file
|
||||
with open(filename, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, indent=2, ensure_ascii=False)
|
||||
f.write(json_str)
|
||||
|
||||
logger.info(f"Data saved to {filename}")
|
||||
except IOError as e:
|
||||
logger.error(f"Error saving data to {filename}: {e}")
|
||||
|
@ -458,9 +473,9 @@ def fetch_wiki_page(key, language='en', is_specific_page=False):
|
|||
|
||||
# Check grammar for French pages
|
||||
grammar_suggestions = []
|
||||
if language == 'fr':
|
||||
logger.info(f"Checking grammar for French page: {key}")
|
||||
grammar_suggestions = check_grammar_with_grammalecte(clean_text)
|
||||
# if language == 'fr':
|
||||
# logger.info(f"Checking grammar for French page: {key}")
|
||||
# grammar_suggestions = check_grammar_with_grammalecte(clean_text)
|
||||
|
||||
# Extract links
|
||||
links = content.select('a')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue