skip to Main Content

Good day. I am creating my first website that has multiple languages. I use html and json files under the names en for english, and rs for serbian. And now I have a problem because I have between the h1 tag and the span tag and I can’t change the span to keep the color it has

"jezik" is name for lang
<h1 class="heading" jezik="heading">Moje <span jezik="heading-span">Usluge</span></h1>

I also have a problem with the icons not being displayed, using font awesome html tag.

I tried to do it like this too:
"heading": "Moje ", "heading-span": "Usluge",

but it didn`t work, only work for "heading".

2

Answers


  1. Chosen as BEST ANSWER

    Yes I followed that website you sent and followed those steps, I set it all up nicely, but I still have a problem with that span tag, which is inside another tag. Javascript is working fine and that is certainly not the problem.

    Also, regarding the icons, it still doesn't work even with the help of the kit, probably because the code is poorly done, so it needs to be changed a bit


  2. In HTML, unless you are using Javascript to look for custom key-value pairs in a tag and do something, then the use of "jezik" as a key is not valid HTML parameter.

    Did some Googling, and if you want the text to change based on the language selected, check out the following article: https://medium.com/@nohanabil/building-a-multilingual-static-website-a-step-by-step-guide-7af238cc8505

    As for the font-awesome question:

    First, make sure you have included the font-awesome javascript, so the CSS/class tags will work properly. You need to build a "kit" on the font-awesome website, which will provide you with a URL to use in the page header, with a <script scr="<url>"></script>

    Then in your page, you can use the tag to specify the icon you want displayed: <span class="fa-solid fa-user"></span>. You have to use "class" populate it with the correct options for the icon you want to display.

    Hope that helps!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search