Skip to:
Content
Pages
Categories
Search
Top
Bottom

best way to add translations?

  • @haddlyapis

    Participant

    Hi,
    My forum is set in German (bbpress-de_DE)
    There are some things in my forum that are not translated.
    e.g: https://www.apis.de/forum/topic/pim-2/ (See top line, a mix of German and English). I have tried editing the bbpress-de_DE-formal.po file using Poedit for Windows, but this does not make any changes.
    How can I edit existing translations and add further translations plz?

Viewing 6 replies - 1 through 6 (of 6 total)
  • @robin-w

    Moderator

    the latest version changed some phrases and they have yet to be added into the translations.

    you can use

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>translations

    @haddlyapis

    Participant

    Thank you!

    @haddlyapis

    Participant

    Hey,
    Unfortunately, upon activating it, it changes the layout of the forum. This would be ok, I could simply take some time to change it, but as there are so many features, I am not sure what else changes.
    Is there any way to take out the functionality of the translation part and make it its own plugin?
    Would this be too much work on your behalf?
    thx for all your help.
    Dan

    @robin-w

    Moderator

    hmm.. shouldn’t alter anything unless asked.

    what part is changing?

    and no, creating a separate plugin takes a couple of hours, and then it needs maintaining, which is why I have put all the bits into a single plugin.

    @haddlyapis

    Participant

    When i activate the plugin, the css styling changes how the forum looks. For example the Topics Index Styling overrides the css of my current layout, which is styled from my own styles.css file.

    @haddlyapis

    Participant

    Hey there, I tried using the translation part of the bbp style pack plugin, while assuming, that once I was able to fix the translations I would then fix the CSS styling issues I have mentioned above (this would just take a little work on my behalf). Anyway, even though it says you have to play around with it to get it right (e.g. add the full stop if there is one etc.), I was not able to implement the translations. I am sure it has something to do with the way my site is set up and not the plugin itself, but alas, I had to find a different option.
    So, here is my frontend Javascript solution. I noticed that I have to put e.g. “weeks” before “week” in the object for it to work (i.e. plural before singular). For anyone who wants to know, the word “aktualisiert” refers to the English word “updated”, (as the verb goes to the end of the sentence in German it is slightly tricky to just translate “this was last updated…..”).
    I am not sure if anyone needs this, but as I require help with my website from time to time from people like those at bbpress (thx btw), if I can be of any help, I would like to. This is an IIFE btw:

    
    /* WB- translate some dodgy sentences (part English/ part German) */
    var translate = function () {
        //check if the page is a forum page. If not, return function
        var isForum = document.querySelector("#bbpress-forums");
        if (!isForum) return;
    
        // find if either forum or topic description (topic is one level lower in the forum where people can answer individual posts. forum is where all the sub-topics are listed
        var forum = document.querySelector(".bbp-forum-description");
        var description = document.querySelector(".bbp-topic-description");
    
        //If not on either the forum description page or the forum topic page, return
        if (!forum && !description) return;
    
        //set a variable to add the innerHTML to 
        var d_text;
    
        if (forum) {
            // if forum has no topics make no tranlation changes and hide the "Oh bother.... div"
            if (forum.innerText === "Dieses Forum ist leer."){ 
            var oh_both_text = document.querySelectorAll(".bbp-template-notice");
            oh_both_text[1].style.display = "none";
            return;
        }
            d_text = forum.innerHTML;
        }
        if (description) {
            d_text = description.innerHTML;
        }
    
        // create object with list to translate (name: = English, value = Deutsch)
        var d_obj = {
            "This forum has": "Dieses Forum hat",
            "This topic has": "Dieses Thema hat",
            "This category has":"Diese Kategorie hat",
            "This topic is empty":"Dieses Thema ist leer",
            "hidden":"verdeckt",
            "and was last updated": "und wurde zuletzt",
            "seconds": "Sekunden",
            "minutes": "Minuten",
            "hours": "Stunden",
            "days":"Tagen",
            "day": "Tag",
            "weeks":"Wochen",
            "week": "Woche",
            "months": "Monaten",
            "month": "Monat",
            "years":"Jahren",
            "year":"Jahr",
            "by": "von"
        }
    
        // use Replace method to run through innerHTML and replace English text with German
        d_text = d_text.replace(/This forum has|This topic has|This category has|This topic is empty|hidden|and was last updated|seconds|minutes|hours|days|day|weeks|week|months|month|years|year|by/gi, function (matched) { return d_obj[matched]; });
    
        //add "aktualisiert" to end of sentence
        if (d_text.indexOf("und wurde zuletzt") > -1) {
        d_text = d_text.slice(0,-1).concat(" aktualisiert.");    }
    
        //update the innerHTML of either the forum or the topic page 
        if (forum) { forum.innerHTML = d_text; }
        if (description) { description.innerHTML = d_text; }
    }();
    
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar