Skip to content
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

Language organization #357

Merged
merged 47 commits into from
Dec 25, 2024
Merged

Language organization #357

merged 47 commits into from
Dec 25, 2024

Conversation

MestreWalla
Copy link
Contributor

Description

  • Each language has its own file in the locales folder.

Related Issues

  • Issue #<158>

Checklist

  • I have read and followed the Contributing Guidelines.
  • I have added necessary tests.
  • The project builds and runs without issues.

- Updated translations in pt-br
added "todoListHeading" because the logic that was there did not work to get the same text from "todoListText"

Portuguese is also fully implemented according to the latest update.
Fixed duplications in the code.
Languages ​​separated into their own files.
@MestreWalla
Copy link
Contributor Author

-The reading order of the script files cannot be changed as it may break the code.
-I was unable to load the files dynamically as an array (the page always crashed when trying other methods as the other scripts did not recognize them).
-I could not import the scripts into another one as we are working on an offline project and this is not allowed.

No necessary
@itz-rj-here
Copy link
Collaborator

Well. By using this method, in web store will show all the languages now.

@itz-rj-here
Copy link
Collaborator

@prem-k-r

@itz-rj-here
Copy link
Collaborator

#158

@itz-rj-here
Copy link
Collaborator

@MestreWalla If you don't mind I have a question. What about the width now?
Will it make such difference without the width limit?

@MestreWalla
Copy link
Contributor Author

@MestreWallaSe você não se importa, eu tenho uma pergunta. E quanto à largura agora? Fará tanta diferença sem o limite de largura?

I didn't understand what you meant.

@itz-rj-here
Copy link
Collaborator

@MestreWallaSe você não se importa, eu tenho uma pergunta. E quanto à largura agora? Fará tanta diferença sem o limite de largura?

I didn't understand what you meant.

image
These. The menu width and the other languages numberings...

@MestreWalla
Copy link
Contributor Author

is still working inside languages.js. just the strings have been separated from the file

@itz-rj-here
Copy link
Collaborator

Uhh 😅
Idk actually. Wait @prem-k-r can you confirm this? If everything is good?..

@prem-k-r
Copy link
Collaborator

Uhh 😅 Idk actually. Wait @prem-k-r can you confirm this? If everything is good?..

Seems good.. should be working fine.. if we want to include those menu width, numerals, comma, data . Etc.. it will be complicated.. we can keep it simple

We can change file name to full code for some language pt-BR, es and zh.. not everywhere.. just file name

This commit refactors the translation logic to make it more concise and maintainable.

Key changes include:
- Replaced the `translationMap` array with a simpler array of strings representing the element IDs.
- Introduced a `placeholderMap` array for handling placeholder translations with custom keys.
- Created a new `applyTranslations` function to encapsulate the translation logic, reducing code duplication and increasing readability.
- Unified the logic for applying translations to placeholders and innerText into the new function.
- Improved the overall structure of the `applyLanguage` function, making it more straightforward and easier to understand.

These changes enhance code clarity, reduce redundancy, and facilitate future modifications related to internationalization.
@prem-k-r
Copy link
Collaborator

prem-k-r commented Dec 22, 2024

There are some issue like for { id: 'googleEngineDD', key: 'googleEngine' }, we have redefine them now

@MestreWalla
Copy link
Contributor Author

22/12/2024 - #1

  • Refactor translation logic for improved maintainability.
    These changes enhance code clarity, reduce redundancy, and facilitate future modifications.
  • Fixed import font on css

@XengShi
Copy link
Owner

XengShi commented Dec 22, 2024

Conflicts!

Updated according to merge conflicts;
New String translated into  Portuguese-BR;

#Tested.
@MestreWalla
Copy link
Contributor Author

Conflicts reviewed, and tested.

Conflicts!

languages.js Outdated
'bingEngine',
'braveEngine',
'youtubeEngine',
'googleEngineDD',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for
{ id: 'todoListHeading', key: 'todoListText' },
{ id: 'googleEngineDD', key: 'googleEngine' },
{ id: 'duckEngineDD', key: 'duckEngine' },
{ id: 'bingEngineDD', key: 'bingEngine' },
{ id: 'braveEngineDD', key: 'braveEngine' },
{ id: 'youtubeEngineDD', key: 'youtubeEngine' },

id not equals key

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved, not committed yet.

locales/en.js Outdated
"ProxyDisclaimer": "All proxy features are off by default.\n\nIf you enable search suggestions and CORS bypass proxy, it is strongly recommended to host your own proxy for enhanced privacy.\n\nBy default, the proxy will be set to https://mynt-proxy.rhythmcorehq.com, meaning all your data will go through this service, which may pose privacy concerns.",
"endlink": "There shouldn't be / at the end of the link",
"onlylinks": "Only links (starting with http:// or https://) are allowed.",
"imagedimensions": "Warning: The uploaded image dimensions ({width}x{height}) exceed 1920x1080 pixels. \n\nThis may impact performance or image may fail to load properly.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todoListHeading, confirmbackup, imagedimensions
have been deleted in latest version from all languages

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need these keys anymore?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also there are new additions
please refer #195 (comment)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can updates the languages if you want.. can raise PR in your branch

.DS_Store Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, is this .DS_Store file needed?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is also one at root folder, is that necessary for mac?

Copy link
Contributor Author

@MestreWalla MestreWalla Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have this file in the project, it works normally.

@XengShi
Copy link
Owner

XengShi commented Dec 23, 2024

Chinese language is not working!

@prem-k-r
Copy link
Collaborator

language code is incorrect, zh instead of zn

@prem-k-r
Copy link
Collaborator

I haven't checked on pc
image
are these transliteration showing?

@prem-k-r
Copy link
Collaborator

@MestreWalla there are some strings missing in some language, can I pull PR in you fork?

Yes

Opened MestreWalla#1

@prem-k-r
Copy link
Collaborator

prem-k-r commented Dec 24, 2024

127 0 0 1_5500_languagesAnalysis html

@prem-k-r prem-k-r mentioned this pull request Dec 24, 2024
3 tasks
@prem-k-r
Copy link
Collaborator

@XengShi please review and merge this..

@XengShi XengShi merged commit 1827fc4 into XengShi:main Dec 25, 2024
XengShi added a commit that referenced this pull request Dec 27, 2024
* Fixed the Centering of menu icon (#324)

* Fixed the Menu Icon

* Added Fix for Dark Mode

* Fixed slight white Outline in MenuIcon

* Fixed slight white Outline in MenuIcon

* Fixed Circle Width of Menu Icon

* Added solid bg behind userText, date & shortcut names

* Added Todo List Feature (#322)

* Added Todo List Feature

* Added a To Do List Toggle in Settings

* Fixed the To Do List loosing focus issue

* Fixed the Errors in Todo List

* Removed the Use of innerHTML to prevent XSS vulnerabilities

* Fixed the Blink Issue and Made the Alert Translatable and Added some Translations

* Removed todo Translations

* Made a few changes to Todo List translations

* Changed Todo Input Placeholder

* Fixed Silly Mistakes

* Switched to JSON Based Approach for To Do List

* Fixed Issue when todoList was not in Local Storage

* Sanitized User Input and Reduced redundancy in Todo code

* Added Comments

* Optimised Todo functions for Reduced Resource Usage

* Removed Alert for when no input is given to ToDo Input Box

* Firefox Reset Setting button width (#287)

* Update style.css

center align date

* Update script.js

shortcuts name text shadow

* Update style.css

fix firefox resetbtn width

* Update script.js

clearbutton color for dark theme

* Update style.css

restrict

* Update style.css

revert center

* Update script.js

replaced innnerhtml

* Update script.js

pasto

* Update script.js

reverted to avoid conflicts

* Update languages.js

Marathi numerals

* Update script.js

revert

* Update languages.js

revert

* Minor changes (#310)

* Update style.css

removed color palette hover text

* Update languages.js

removed page reload hint

* Update index.html

corrected size and icon of meta ai

* Update style.css

readjusted spacings

* Update style.css

+1

* Update languages.js

hindi translation update

* Update languages.js

* Update README.md

added french

* Update languages.js

meta ai trans

* Update style.css

* Update style.css

* Update style.css

savebtn click effect

* Update script.js

hover effect for upload and random wp

* Update languages.js

* Update script.js

* Update feedback.html

GITHUB LINK UPDATE

* Update github-shortcut.svg

opacity changed

* Update script.js

moved try, and cordinate fetching instead of city name from ipinfo

* Update README.md

fix conflicts

* Update script.js

removed shadow for dark mode

* Update script.js

solid bg

* Update style.css

revert from css

* Update script.js (#325)

innerhtml mutable

* Fixed the Todo Item Overflow (#326)

* Enhancement related to To-Do list (#330)

* Update style.css

limit scrollbar

* Update index.html

svg cleanup and scaling

* Update style.css

cleanup

* Update style.css

more cleanup

* Update style.css

+ symbol

* Update script.js

for dark

* Update style.css

cross color

* Update script.js

for dark

* Update languages.js

* Update languages.js

bn

* Update script.js

fix conflicts

* Fixed Search Suggestion for Chromium browsers (#345)

* Update manifest.json

added host permissions

* Update script.js

https

* Update languages.js

* Added ID translation for alert and to-do list (and sync translation for restore) (#340)

* Adding translation for ToDo List (#335)

* Adding translation for ToDo List

* Adding the translation for the rest strings

* l10n: Update Czech translation (#338)

* l10n: Add Czech translation of To Do list

* l10n: Add Czech translation of pick color button

* l10n: Add Czech translation for messages from dialog boxes

* Fixed the Flash Issue during Reload (#336)

* Added Color Changing Loading Screen

* Replaced Loading Image with Optimised one

* Removed Async from the Script Tag

* Added Preload.js

* Feature: Added Pinning Functionality to ToDo List (#337)

* Added Pinning Functionality to ToDo List

* Renamed Todo Span and Fixed Minor Indentation Issues

* Update script.js

darktheme removebtn hover

* Update style.css

minor adjustments

* Update style.css

* Update style.css

* Update style.css

font size 17 to 16

* Updated Todo SVGs

* Added No deletion of Pending Tasks and Resetting of Pinned Completed tasks

---------

Co-authored-by: Prem Kumar <[email protected]>

* add Azerbaijani language (#348)

* add Azerbaijani language

* update README.md

* Azerbaijan language updated

* Azerbaijan language updated

* Azerbaijan language missing words added

* Azerbaijan language fixing problems

* Azerbaijan language last edit

* Azerbaijan language last edit

* Update pt-br translations (#341)

* Update pt-br translations

- Updated translations in pt-br

* Portuguese 100% updated

added "todoListHeading" because the logic that was there did not work to get the same text from "todoListText"

Portuguese is also fully implemented according to the latest update.

* Storing Images as Blobs Instead of Base64 (#351)

* Update script.js

base64 to blobs

* Update languages.js

delete removed alert

* Update languages.js

delete duplicate and unnecessary

* Update languages.js

* Introducing New Bookmark System for the Extention (#349)

* Introducing New Bookmark System for the Extention

* Reverted BG

* Error fixes...

* Mirror Changes

Fixed Icon issue on taking permission and fixed gapps right arrow being placed over.

* Enhanced Bookmarks UI

* Updated Bookmarks Bar

* Fixed Bookmarks Scrollbar

* Minor Fixes

* Used icons which doesn't have padding

Co-Authored-By: Prem Kumar <[email protected]>

* Added Mobile Bookmarks

* Changed the Searchbar id

* Changed the space formats

* Removed all useless comments and added brave navigator

* Added comment back again and added navigator.brave.isBrave too

* Added z-index on rotating of the arrow key

* Maintained some space on the code

* Added Bookmarks Toggle

* Added All Folders View and Default Folders for Each Browser

* Update style.css

minor style update

* Update script.js

some functionalities

* Update script.js

* Update script.js

Ctrl+Click to Open in a New Tab

* Delete favicon/icon.png

* Add files via upload

* Delete favicon/icon.png

* Add files via upload

* Bangla translation for bookmark added

* Firefox icon fixed

* Update manifest(firefox).json

* Update script.js

* Added Grid View

* Update script.js

* Revert "Feature/bookmark enhancements"

* Update index.html

* Update languages.js

* Fixed gapps arrow got placed over

* Update script.js

* Update script.js

* Update style.css

* Update manifest.json

* Update manifest.json

removed bg.js

* Fixed Errors and Added Toggle

* Update script.js

fix delete in firefox

* Fixed Conflicts

* Fixed Unfolding Issue

* Update script.js

fix conflicts

* Update index.html

* Fixed Bookmark Search Issues

* Made Favicon Bigger and Replaced search icon url with SVG

* Made Bookmarks load only when arrow is clicked or right arrow key is pressed

* Fixed Issues

* Attempt to Fix All Issues

* API not defined error fixed

* Corrected Language in Bangla

* Fixed Arrow Error

* Fixed Bookmark Dark Mode and Added Support for Bookmark Translation

* Added Requested Changes

* Made the Arrow Smaller

* Update script.js

* Update style.css

* Delete svgs/bookmarksSearch.svg

* Add files via upload

* Update style.css

* Update languages.js

---------

Co-authored-by: ThunderBlaze <[email protected]>
Co-authored-by: Prem Kumar <[email protected]>
Co-authored-by: Shivansh <[email protected]>

* Added stylish rounded corner

* Style corners

* Bookmark strings translation (for hi and bn) (#361)

* Update index.html

* Update languages.js

* WeatherAPI api key update for main branch (#347)

* Update manifest.json

* Update script.js

api keys

* Update manifest(firefox).json

* Language organization (#357)

* Update pt-br translations

- Updated translations in pt-br

* Portuguese 100% updated

added "todoListHeading" because the logic that was there did not work to get the same text from "todoListText"

Portuguese is also fully implemented according to the latest update.

* Language organization

Fixed duplications in the code.
Languages ​​separated into their own files.

* Update pt.js

No necessary

* Refactor translation logic for improved maintainability

This commit refactors the translation logic to make it more concise and maintainable.

Key changes include:
- Replaced the `translationMap` array with a simpler array of strings representing the element IDs.
- Introduced a `placeholderMap` array for handling placeholder translations with custom keys.
- Created a new `applyTranslations` function to encapsulate the translation logic, reducing code duplication and increasing readability.
- Unified the logic for applying translations to placeholders and innerText into the new function.
- Improved the overall structure of the `applyLanguage` function, making it more straightforward and easier to understand.

These changes enhance code clarity, reduce redundancy, and facilitate future modifications related to internationalization.

* Updated language files

Updated according to merge conflicts;
New String translated into  Portuguese-BR;

#Tested.

* improved translation logic

Fixed keys with different keys;
Fixed Chinese variables (cn -> ch); (Tested)
Page updates language without reloading the entire page again; (Working but Google Translate tries to translate from the previous language (possible to see in the console));

* Conflicts fixed

* Add language key analysis tool

Introduces a language analysis tool in the `tools` directory.
This tool identifies complete and incomplete translations, displaying missing keys for incomplete languages.
Access is manual via the `tools` directory.

* Delete .DS_Store

* Delete teste

* Update languages.js

* Update en.js

* Update pt.js

* Update en.js

* Update script.js

removed proxy alert

* Update script.js

typo

* Update zh.js

* Update hi.js

* update 24/12/2024

updated language helper tool to show remaining strings;
page updated to correctly translate weather;
Languages ​​updated from ChengShi repository.

* Update cs.js

* Update it.js

* Update tr.js

* Update bn.js

* Update vi.js

* Update ru.js

* Update ru.js

paste error

* Update bn.js

paste error

* Update bn.js

* Update uz.js

* Update es.js

* Update ja.js

* Update ko.js

* Update idn.js

* Update idn.js

* Update mr.js

* Update fr.js

* Update az.js

* Update background.js

---------

Co-authored-by: Prem Kumar <[email protected]>

* Update manifest(firefox).json (#373)

* Changed Bookmark Icon (#378)

* Changed Bookmark Icon

* Fixed Dark Mode Bookmark Icon

* Made Bookmark Tooltip Translatable

* Updating Bookmarks strings using fr.js in locales folder (#376)

* Added ID translation for bookmarks and invalid backup file message (#380)

* Fix color in firefox 2 (#371)

* Fix colour glithes

* returned isFireFox

* Request changes applied.

* Alert to consloe error.

* Request changes applied.

* Added Slovenian translations (#379)

* l10n: Update Czech translation (#367)

* l10n: Add Czech translation for bookmarks

* l10n: Add Czech translation of invalid backup file

* refactor: Reformat Czech translation file

* Fix/bookmark icon (#382)

* Changed Bookmark Icon

* Fixed Dark Mode Bookmark Icon

* Made Bookmark Tooltip Translatable

* Made Bookmark Icon move only when Google Apps is Enabled

* Fixed Some Things

* Reduced Redundancy in Language Page (#381)

* Requested Changes

* Updated Manifest

* Restored Manifest

* Version 3 to 3.0

---------

Co-authored-by: XengShi <[email protected]>
Co-authored-by: Prem Kumar <[email protected]>
Co-authored-by: Ayyas-RF <[email protected]>
Co-authored-by: 422.io <[email protected]>
Co-authored-by: Michal Šmahel <[email protected]>
Co-authored-by: Hasan Bakhtiar <[email protected]>
Co-authored-by: Maycon Vitor Correa <[email protected]>
Co-authored-by: It'z RJ <[email protected]>
Co-authored-by: giwi <[email protected]>
Co-authored-by: Aleks Marinič <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants