Code Monkey home page Code Monkey logo

Comments (4)

sysadmin-info avatar sysadmin-info commented on May 30, 2024 1

I was wondering is there any option to add i18n translation to at least translate buttons next and previous. Of course I can try to do it on my own. I know I can hardcode this oj file, but you know that this approach is not something that I want to achieve. Besides adding a language file is much easier for average user.

Originally posted by @sysadmin-info in #24 (comment)

The solution is quite simple. All you have to do is to create a i18n directory inside your plugin, where README.md is located. Then put inside the i18n directory file en.toml, pl.toml, fr.toml etc. for each language.

Example content of en.toml

[embed-pdf-next]
other = "Next"

[embed-pdf-prev]
other = "Previous"

Example content of pl.toml

[embed-pdf-next]
other = "Następna"

[embed-pdf-prev]
other = "Poprzednia"

Then in your file embed-pdf.html inside the shortcodes directory you have to change Next and Previous to this:

        <button id="pdf-prev-{{ substr (.Get "url" | md5) 0 8 }}">{{ i18n "embed-pdf-prev" }}</button>
        <button id="pdf-next-{{ substr (.Get "url" | md5) 0 8 }}">{{ i18n "embed-pdf-next" }}</button>

from hugo-embed-pdf-shortcode.

sysadmin-info avatar sysadmin-info commented on May 30, 2024 1

The problem is that I have no idea how to raise a PR. I already tested it on my side and it is working as expected.

from hugo-embed-pdf-shortcode.

anvithks avatar anvithks commented on May 30, 2024

Would you be able to raise a PR for this solution? I can test it out.

from hugo-embed-pdf-shortcode.

anvithks avatar anvithks commented on May 30, 2024

The problem is that I have no idea how to raise a PR. I already tested it on my side and it is working as expected.

Sure. No worries .
Let me check how it's done and will push these changes

from hugo-embed-pdf-shortcode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.