Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter kiralikbeyin

    (@kiralikbeyin)

    GDPR text needs to be changed for different languages. Polylang does not see “GDPR text” as a parameter. Instead of using JS or php functions, if you add the texts that users see (3-5 parameteres only) to the dictionary, it will be a definitive solution. ??????????

    Thread Starter kiralikbeyin

    (@kiralikbeyin)

    It was a simple issue with the theme I was using. Thank you.

    Thread Starter kiralikbeyin

    (@kiralikbeyin)

    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

    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.

    Thread Starter kiralikbeyin

    (@kiralikbeyin)

    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.

    import os
    import csv
    import polib

    # Define the paths
    input_csv = './input.csv'
    output_directory = './output'

    # Ensure the output directory exists
    os.makedirs(output_directory, exist_ok=True)

    # Define the language codes and their corresponding columns
    languages = {
    '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 source
    entries_by_source = {}

    # Read the CSV and organize entries by source
    with 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 language
    for 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.

    Thread Starter kiralikbeyin

    (@kiralikbeyin)

    my two cents

    Export target langs .po from translations tab

    pip install polib googletrans==4.0.0-rc1

    python translate_po_files.py

    import os
    import polib
    from googletrans import Translator

    # Define directories
    input_dir = './input/de'
    output_dir = './output/de'

    # Ensure the output directory exists
    os.makedirs(output_dir, exist_ok=True)

    # Initialize the Google Translator
    translator = Translator()

    # Function to translate a .po file
    def 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 directory
    for 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

    (@kiralikbeyin)

    I removed google pay and apple pay from mini cart and now everything is perfect. Thanks a lot!

    • This reply was modified 1 year, 5 months ago by kiralikbeyin.
    Thread Starter kiralikbeyin

    (@kiralikbeyin)

    Google pagespeed suggested shrinking this unused js file.
    1,141.8 KiB

    There are too many errors in the console.. pictures are attached.

    Thread Starter kiralikbeyin

    (@kiralikbeyin)

    I get normal xml file with condition now; I only changed number of products it was only 3 items in a category. Now it has 21 products. I can get condition in xml.
    Thanks.

    Thread Starter kiralikbeyin

    (@kiralikbeyin)

    I was getting condition error from merchant so i manually edit and upload it.

    I see condition variable in the plugin but some how it didn’t added to xml file.

    wp 4.9.1, optional variable sale_price, default condition variable is new (i didn’t change anything with this field)

    Maybe some other plugins make trouble so its difficult to debug.

    Thread Starter kiralikbeyin

    (@kiralikbeyin)

    Hi @aukejomm

    I manually edit and add condition and upload to merchant. This is a required field.

    <g:availability>in stock</g:availability>
    <g:condition>new</g:condition>

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