-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add multi language support #2427
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,8 @@ | |
<div id="root"></div> | ||
<script src="https://cdn.lordicon.com/lordicon.js"></script> | ||
<script type="module" src="/src/main.jsx"></script> | ||
<div class="gtranslate_wrapper"></div> | ||
<script>window.gtranslateSettings = {"default_language":"en","languages":["en","hi","mr","pa","ja","ru","ta"],"wrapper_selector":".gtranslate_wrapper","horizontal_position":"right","vertical_position":"bottom"}</script> | ||
<script src="https://cdn.gtranslate.net/widgets/latest/flags.js" defer></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add integrity and crossorigin attributes to the external script. Loading external scripts without integrity checks poses a security risk. Consider adding integrity and crossorigin attributes to protect against compromised CDN scenarios. -<script src="https://cdn.gtranslate.net/widgets/latest/flags.js" defer></script>
+<script src="https://cdn.gtranslate.net/widgets/latest/flags.js"
+ integrity="sha384-HASH_VALUE_HERE"
+ crossorigin="anonymous"
+ defer></script> Note: Replace
|
||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider adding CSS to handle widget positioning and responsiveness.
The widget's position is set through JavaScript, but you might want to add CSS to ensure proper display across different screen sizes and prevent overlap with other UI elements.
Add these styles to your CSS:
💡 Codebase verification
Add
defer
to the lordicon script to improve page load performanceThe gtranslate script is properly deferred, but there's another render-blocking script from lordicon.com that could impact page load performance. While the translation widget implementation follows performance best practices:
defer
attribute appropriatelyThe following script should be modified to include
defer
:<script src="https://cdn.lordicon.com/lordicon.js"></script>
🔗 Analysis chain
Verify the impact on page load performance.
The addition of the translation widget might affect the page's load performance. Consider:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 353
Script:
Length of output: 1378