Bluesky app fork with some witchin' additions 💫 witchsky.app
bluesky fork client

add translation engine choice into tweaks, add kagi as option #51

merged opened by daniela.lol targeting main from daniela.lol/witchsky.app: main

this is HEAVILY based on code thats inside the wip post-text-option branch, i saw what was going on in there and instantly thought about other ways that could be used and decided to write this quickly

this currently only adds kagi as a separate engine, i was thinking on adding deepl but im not sure if it supports translating through url...? if it does i mustve missed it, but absolutely use this as a base to add whatever translation engines u want to

this could 100% be done better but im not smart so this was my quick n dirty solution, feel free to improve this

works on both desktop and android, lemme know if theres any issues

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:x3vdwseoxbzbp2dfv7q3brqn/sh.tangled.repo.pull/3md7rdpcm5c22
+10 -8
Interdiff #0 #1
+4 -2
src/lib/hooks/useTranslate.ts
··· 17 17 18 18 // if ur curious why this isnt a switch case, good question, for some reason making this a switch case breaks the functionality 19 19 // it is a mystery https://www.youtube.com/watch?v=fq3abPnEEGE 20 - if (translationServicePreference == 'kagi') 20 + if (translationServicePreference == 'kagi') { 21 21 translateUrl = getTranslatorLinkKagi(text, language) 22 - else translateUrl = getTranslatorLink(text, language) 22 + } else { 23 + translateUrl = getTranslatorLink(text, language) 24 + } 23 25 24 26 if (IS_ANDROID && translationServicePreference == 'google') { 25 27 try {
src/locale/helpers.ts

This file has not been changed.

+6 -6
src/screens/PostThread/components/ThreadItemAnchor.tsx
··· 622 622 // overridden to open an intent on android, but keep 623 623 // as anchor tag for accessibility 624 624 to={ 625 + // in case u want to expand this to allow other services to be u would do this after the kagi one 626 + // : translationServicePreference === "insert service name" 627 + // ? getTranslatorLink(post.record.text, langPrefs.primaryLanguage, "insert service name") 628 + // atm i cant really think of another service that lets u easily do this so its only kagi for now 629 + // the default itll use if its not any of the checks is google!! 625 630 translationServicePreference === 'kagi' 626 631 ? getTranslatorLinkKagi( 627 632 post.record.text, 628 633 langPrefs.primaryLanguage, 629 634 ) 630 - : // in case u want to expand this to allow other services to be u would do this 631 - // : translationServicePreference === "insert service name" 632 - // ? getTranslatorLink(post.record.text, langPrefs.primaryLanguage, "insert service name") 633 - // atm i cant really think of another service that lets u easily do this so its only kagi for now 634 - // the default itll use if its not any of the checks is google!! 635 - getTranslatorLink( 635 + : getTranslatorLink( 636 636 post.record.text, 637 637 langPrefs.primaryLanguage, 638 638 )
src/screens/Settings/DeerSettings.tsx

This file has not been changed.

src/state/persisted/schema.ts

This file has not been changed.

src/state/preferences/index.tsx

This file has not been changed.

src/state/preferences/translation-service-preference.tsx

This file has not been changed.

History

3 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
change translation engine tweak
expand 0 comments
pull request successfully merged
2 commits
expand
change translation engine tweak
vs code did some weird auto formatting n that sketches me out
expand 0 comments
1 commit
expand
change translation engine tweak
expand 0 comments