Title: csv limits &#8211; 504 error
Last modified: September 14, 2024

---

# csv limits – 504 error

 *  Resolved [kiralikbeyin](https://wordpress.org/support/users/kiralikbeyin/)
 * (@kiralikbeyin)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/csv-limits-504-error/)
 * I selected the plugins and exported them.
 * First I tried to import 8000 lines with 8 languages ​​but I got a 504 error.
   
   When I upload a csv file with 500 lines and 1 language I see “Translations updated.
   Items: 0.”
 * In order not to get a 504 error;
   How many languages ​​can be imported at the 
   same time?How many lines should the CSV file have at most?
 * **Some** plugins (not all) appear to be translated but I don’t know which ones
   were imported because I keep getting a 504 error.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [kiralikbeyin](https://wordpress.org/support/users/kiralikbeyin/)
 * (@kiralikbeyin)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/csv-limits-504-error/#post-18014569)
 * my two cents
   Export target langs .po from translations tab
 * pip install polib googletrans==4.0.0-rc1
 * python translate_po_files.py
 *     ```wp-block-code
       import osimport polibfrom googletrans import Translator# Define directoriesinput_dir = './input/de'output_dir = './output/de'# Ensure the output directory existsos.makedirs(output_dir, exist_ok=True)# Initialize the Google Translatortranslator = Translator()# Function to translate a .po filedef translate_po_file(input_path, output_path):    po = polib.pofile(input_path)    for entry in po:        if entry.msgstr == entry.msgid or not entry.msgstr:  # Translate if msgstr is empty or same as msgid            print(f"Translating: {entry.msgid}")            translated = translator.translate(entry.msgid, src='en', dest='de').text            entry.msgstr = translated            print(f"Translated to: {translated}")        else:            print(f"Skipped (Already translated): {entry.msgid}")    po.save(output_path)    print(f"Translated file saved: {output_path}\n")# Translate all .po files in the input directoryfor filename in os.listdir(input_dir):    if filename.endswith(".po"):        input_path = os.path.join(input_dir, filename)        output_path = os.path.join(output_dir, filename)        print(f"Processing file: {filename}")        translate_po_file(input_path, output_path)print("Translation complete!")
       ```
   
 *  Thread Starter [kiralikbeyin](https://wordpress.org/support/users/kiralikbeyin/)
 * (@kiralikbeyin)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/csv-limits-504-error/#post-18014597)
 * my four cents
 * Select plugins, export csv file, export to google sheets, translate google sheet
   cells with:
   =IF(A2=””, “”, GOOGLETRANSLATE(A2, “en”, “de”))download csv, name:“
   input.csv”all po files splited by plugin name in output dir with related translation.
   po filename.
 *     ```wp-block-code
       import osimport csvimport polib# Define the pathsinput_csv = './input.csv'output_directory = './output'# Ensure the output directory existsos.makedirs(output_directory, exist_ok=True)# Define the language codes and their corresponding columnslanguages = {    'de_DE': 'Deutsch (de_DE)',    'fr_FR': 'Français (fr_FR)',    'it_IT': 'Italiano (it_IT)',    'tr_TR': 'Türkçe (tr_TR)',    'es_ES': 'Español (es_ES)',    'pt_PT': 'Português (pt_PT)',    'ar': 'العربية (ar)'}# Store entries for each sourceentries_by_source = {}# Read the CSV and organize entries by sourcewith open(input_csv, newline='', encoding='utf-8') as csvfile:    reader = csv.DictReader(csvfile)    for row in reader:        source = row['Source (plugin or theme)']        if source not in entries_by_source:            entries_by_source[source] = {lang_code: [] for lang_code in languages}        for lang_code, lang_column in languages.items():            entry = polib.POEntry(                msgid=row['English (en_GB)'],                msgstr=row[lang_column],                comment=f'TTfP: {source}, {row["String"]}'            )            entries_by_source[source][lang_code].append(entry)# Create .po files for each source and languagefor source, entries in entries_by_source.items():    for lang_code, po_entries in entries.items():        po = polib.POFile()        po.metadata = {            'Project-Id-Version': 'Polylang/3.6.4',            'POT-Creation-Date': '2024-09-14 11:53+0000',            'PO-Revision-Date': '2024-09-14 11:53+0000',            'Language': lang_code,            'MIME-Version': '1.0',            'Content-Type': 'text/plain; charset=utf-8',            'Content-Transfer-Encoding': '8bit',            'X-Polylang-Site-Reference': 'https://intelplug.com',            'X-Source-Language': 'en-GB',        }        # Add the entries to the PO file        po.extend(po_entries)        # Create the output directory for the source if it doesn't exist        source_output_dir = os.path.join(output_directory, source)        os.makedirs(source_output_dir, exist_ok=True)        # Save the PO file        po_file_path = os.path.join(source_output_dir, f"{lang_code}.po")        po.save(po_file_path)        print(f"Saved: {po_file_path}")print("Translation complete!")
       ```
   
 * I tried to import the PO file with 890 translations and I still got a 504 error,
   but the translations appear in the translation tab.
 *  Plugin Author [Marcin Kazmierski](https://wordpress.org/support/users/marcinkazmierski/)
 * (@marcinkazmierski)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/csv-limits-504-error/#post-18020259)
 * Hello [@kiralikbeyin](https://wordpress.org/support/users/kiralikbeyin/) , How
   much ram do you have available for the PHP process?
 *  Thread Starter [kiralikbeyin](https://wordpress.org/support/users/kiralikbeyin/)
 * (@kiralikbeyin)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/csv-limits-504-error/#post-18056612)
 * It is impossible to manage 8 languages ​​with 512mb ram. I have been using wordpress.
   com for a long time but this is the first time I am translating.
 * I tried all of them for this project: google, aws, digitalocean, vultr, elementor
   hosting, cloudways.
 * I was able to set up a real speed (they use litespeed server) and smooth running
   wp only with hostinger. I had some prejudice before but cloud hosting is really
   good, I recommend it to everyone.
   It said there was a 20% discount; [https://cart.hostinger.com/pay/2acbfd6f-2ee3-4567-a81b-8ef037d9ae8a?_ga=GA1.3.942352702.1711283207](https://cart.hostinger.com/pay/2acbfd6f-2ee3-4567-a81b-8ef037d9ae8a?_ga=GA1.3.942352702.1711283207)
 * …
 * Now there is something I don’t understand, if I make translations with the ttfb
   plugin and then disable ttfb, the translations disappear, is this normal? Does
   the ttfb plugin need to be active all the time after making a translation?
 * I will try to put the .po .mo files in the language folder of the plugins I am
   translating in a bit.
 *  Plugin Author [Marcin Kazmierski](https://wordpress.org/support/users/marcinkazmierski/)
 * (@marcinkazmierski)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/csv-limits-504-error/#post-18081084)
 * I have optimised the translation import process.
   Please check in the latest version
   of the plugin: 3.4.8

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘csv limits – 504 error’ is closed to new replies.

 * ![](https://ps.w.org/theme-translation-for-polylang/assets/icon-256x256.png?rev
   =1431912)
 * [Theme and plugin translation for Polylang (TTfP)](https://wordpress.org/plugins/theme-translation-for-polylang/)
 * [Support Threads](https://wordpress.org/support/plugin/theme-translation-for-polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/theme-translation-for-polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/theme-translation-for-polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/theme-translation-for-polylang/reviews/)

## Tags

 * [504 Error](https://wordpress.org/support/topic-tag/504-error/)
 * [csv](https://wordpress.org/support/topic-tag/csv/)
 * [limits](https://wordpress.org/support/topic-tag/limits/)

 * 5 replies
 * 2 participants
 * Last reply from: [Marcin Kazmierski](https://wordpress.org/support/users/marcinkazmierski/)
 * Last activity: [1 year, 7 months ago](https://wordpress.org/support/topic/csv-limits-504-error/#post-18081084)
 * Status: resolved