Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Add language support to spellchecker
Browse files Browse the repository at this point in the history
Resolves #942
  • Loading branch information
christianbundy committed Nov 12, 2019
1 parent aa56a27 commit 78ba69d
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/context-menu-and-spellcheck.js
Expand Up @@ -6,13 +6,13 @@ const ref = require('ssb-ref')
let navigateHandler = null
module.exports = setupContextMenuAndSpellCheck

function setupContextMenuAndSpellCheck (config, { navigate, getMessageText }) {
function setupContextMenuAndSpellCheck (config, { navigate, getMessageText, language }) {
navigateHandler = navigate
const spellCheckHandler = new SpellCheckHandler()
spellCheckHandler.attachToInput()

// Start off as US English, America #1 (lol)
spellCheckHandler.switchLanguage('en-US')
spellCheckHandler.switchLanguage(language || 'en-US')

const contextMenuBuilder = new ContextMenuBuilder(spellCheckHandler, null, true, (menu, menuInfo) => {
const ddg = new MenuItem({
Expand Down
3 changes: 2 additions & 1 deletion lib/main-window.js
Expand Up @@ -49,7 +49,8 @@ module.exports = function (config) {
}))

const i18n = api.intl.sync.i18n
setupContextMenuAndSpellCheck(api.config.sync.load(), { navigate, getMessageText })
const language = api.settings.obs.get('patchwork.lang', '')()
setupContextMenuAndSpellCheck(api.config.sync.load(), { navigate, getMessageText, language })

const id = api.keys.sync.id()
const latestUpdate = LatestUpdate()
Expand Down
49 changes: 46 additions & 3 deletions locales/de.json
Expand Up @@ -180,7 +180,6 @@
"An error occurred while publishing your message.": "Ein Fehler trat auf während deine Nachricht publiziert wurde.",
"Missing message": "Nachricht fehlt",
" via ": " über ",
"Follow Back": "Zurück Folgen",
"Cannot load thread": "Thread konnte nicht geladen werden",
"The author of this message could be outside of your follow range or they may be blocked.": "Der Autor dieser Nachricht könnte außerhalb deiner Follow-Range sein oder ist geblockt.",
"(missing message)": "(Nachricht fehlt)",
Expand All @@ -199,5 +198,49 @@
"Information": "Information",
"By default, Patchwork will only see other users that are on the same local area network as you.": "Patchwork wird dir zu Anfang nur Nutzer*innen anzeigen die im selben lokalen Netzwerk sind wie du.",
"In order to share with users on the internet, you need to be invited to a pub server.": "Um mit Nutzer*innen aus dem Internet zu tauschen, brauchst du eine Einladung für einen PubServer.",
" from your extended network": " aus deinem erweiterten Netzwerk"
}
" from your extended network": " aus deinem erweiterten Netzwerk",
"Clear Draft": "Clear Draft",
"Preview & Publish Privately": "Preview & Publish Privately",
"Preview & Publish": "Preview & Publish",
"You may not be able to see new content until you follow some users or pubs.": "You may not be able to see new content until you follow some users or pubs.",
"You are not following anyone": "You are not following anyone",
"For help getting started, see the guide at ": "For help getting started, see the guide at ",
"Nobody will be able to see your posts until you have a follower. The easiest way to get a follower is to use a pub invite as the pub will follow you back. If you have already redeemed a pub invite and you see it has not followed you back on your profile, try another pub.": "Nobody will be able to see your posts until you have a follower. The easiest way to get a follower is to use a pub invite as the pub will follow you back. If you have already redeemed a pub invite and you see it has not followed you back on your profile, try another pub.",
"You have no followers": "You have no followers",
"Participating": "Participating",
"All Threads": "All Threads",
"Threads Started By You": "Threads Started By You",
"All": "All",
"Attending": "Attending",
"Tags": "Tags",
"Search for word, @feedId, #channel or %msgId\nYou can also add author:@id or is:private for more filtering": "Search for word, @feedId, #channel or %msgId\nYou can also add author:@id or is:private for more filtering",
"Click to unlike": "Click to unlike",
"Liked": "Liked",
"Add / Edit Tags": "Add / Edit Tags",
"forked from parent thread ": "forked from parent thread ",
"%s people": {
"one": "%s people",
"other": "%s people"
},
"followed": "followed",
"Hide details": "Hide details",
"Show details": "Show details",
"subscribed to": "subscribed to",
"Browse Recently Active": "Browse Recently Active",
"el": "el",
"eo": "eo",
"fr": "fr",
"pl": "pl",
"ru": "ru",
"sk": "sk",
"sl": "sl",
"uk": "uk",
"ur": "ur",
"zh-CN": "zh-CN",
"zh-TW": "zh-TW",
"Font Family": "Font Family",
"Notification Options": "Notification Options",
"Include \"Participating\" tab in navigation bar": "Include \"Participating\" tab in navigation bar",
"Blocking": "Blocking",
"Automatically delete messages from blocked authors. This is irreversible and will cause problems with clients that share the database but do not support deleted messages. Enable at your own risk!": "Automatically delete messages from blocked authors. This is irreversible and will cause problems with clients that share the database but do not support deleted messages. Enable at your own risk!"
}
13 changes: 10 additions & 3 deletions locales/el.json
@@ -1,5 +1,5 @@
{
"Publishing...": "Δημοσίευση...",
"Publishing...": "Δημοσίευση...",
"Publish": "Δημοσίευση",
"Preview & Publish Privately": "Προεπισκόπηση & Κρυφή Δημοσίευση",
"Preview & Publish": "Προεπισκόπηση & Δημοσίευση",
Expand Down Expand Up @@ -307,5 +307,12 @@
"%s people": {
"one": "%s people",
"other": "%s people"
}
}
},
"All": "All",
"Attending": "Attending",
"eo": "eo",
"zh-TW": "zh-TW",
"Font Family": "Font Family",
"Blocking": "Blocking",
"Automatically delete messages from blocked authors. This is irreversible and will cause problems with clients that share the database but do not support deleted messages. Enable at your own risk!": "Automatically delete messages from blocked authors. This is irreversible and will cause problems with clients that share the database but do not support deleted messages. Enable at your own risk!"
}

0 comments on commit 78ba69d

Please sign in to comment.