• Resolved teemuee

    (@teemuee)


    How to translate feeds meta info? Spesicifally, the date in a “time ago” format is saying “hours ago” or “days ago” even though I would like it to be in Portuguese. Also the pagination options gives “Newer/Older” option, which is nice, but I would love to translate that too.

    I’m do not want to download any third party translator plugins to do it because they slow the sites page load time down.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • In the plugin’s code, all translatable strings are placed inside a double underscore function along with a specified domain.

    Here is an example:

    __( 'Older posts', WPRSS_TEXT_DOMAIN )

    This is the internationalization part of translation, also known as i18n, that makes ‘Older posts’ available for translation.

    A program like PoEdit can read code and find all the text inside such functions, and put all such found text in a po file. We provide this file in our plugins in the languages folder.

    You can open that file in PoEdit, and provide different versions of the text for different languages, and then save that translation in an mo file. This is the localization part of translation, also known as l10n.

    When the code runs, the double underscore function will look for an mo file with the name domain-lang.mo. Example: wprss-en_US.mo. From that file, it will load the translation for ‘Older posts’ when you run the site in the desired language.

    You can read more about internationalization at the Common APIs Handbook page.

    Is there anything else I can help with?

    Thread Starter teemuee

    (@teemuee)

    Thank you Naveed, that was exactly what I needed!

    I managed to translate the “Newer/Older” succesfully, but I’m still struggling with the “Time Ago” format. When I open the .po file with Poedit theres a possibility to translate “%1$s ago”, what should I use instead of “%1$s”?

    This might help to explain: https://www.ultimasnoticias.site/wp-content/uploads/2020/07/Screen-Shot-2020-07-03-at-10.53.47.png

    @teemuee Are you using PHP 7.0 or later? If so, I can provide a customization.

    Thread Starter teemuee

    (@teemuee)

    @hypersonic Yes, PHP 7.4.6 in one of the sites and another one is using PHP 7.3.

    Thinking this through, our team has decided to include translations you mentioned in a new release of our core plugin soon.

    Please keep an eye out for a new release that we plan to publish soon.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Translate feed’s meta info’ is closed to new replies.