feat: add desktop repo (#1071)

This commit is contained in:
Mo
2022-06-07 11:52:15 -05:00
committed by GitHub
parent 0bb12db948
commit 0b7ce82aaa
135 changed files with 17821 additions and 180 deletions

View File

@@ -0,0 +1,160 @@
import { Strings } from './types'
export function createEnglishStrings(): Strings {
return {
appMenu: {
edit: 'Edit',
view: 'View',
hideMenuBar: 'Hide Menu Bar',
useThemedMenuBar: 'Use Themed Menu Bar',
minimizeToTrayOnClose: 'Minimize To Tray On Close',
backups: 'Backups',
enableAutomaticUpdates: 'Enable Automatic Updates',
automaticUpdatesDisabled: 'Automatic Updates Disabled',
disableAutomaticBackups: 'Disable Automatic Backups',
enableAutomaticBackups: 'Enable Automatic Backups',
changeBackupsLocation: 'Change Backups Location',
openBackupsLocation: 'Open Backups Location',
emailSupport: 'Email Support',
website: 'Website',
gitHub: 'GitHub',
slack: 'Slack',
twitter: 'Twitter',
toggleErrorConsole: 'Toggle Error Console',
openDataDirectory: 'Open Data Directory',
clearCacheAndReload: 'Clear Cache and Reload',
speech: 'Speech',
close: 'Close',
minimize: 'Minimize',
zoom: 'Zoom',
bringAllToFront: 'Bring All to Front',
checkForUpdate: 'Check for Update',
checkingForUpdate: 'Checking for update…',
updateAvailable: '(1) Update Available',
updates: 'Updates',
releaseNotes: 'Release Notes',
openDownloadLocation: 'Open Download Location',
downloadingUpdate: 'Downloading Update…',
manuallyDownloadUpdate: 'Manually Download Update',
spellcheckerLanguages: 'Spellchecker Languages',
installPendingUpdate(versionNumber: string) {
return `Install Pending Update (${versionNumber})`
},
lastUpdateCheck(date: Date) {
return `Last checked ${date.toLocaleString()}`
},
version(number: string) {
return `Version: ${number}`
},
yourVersion(number: string) {
return `Your Version: ${number}`
},
latestVersion(number: string) {
return `Latest Version: ${number}`
},
viewReleaseNotes(versionNumber: string) {
return `View ${versionNumber} Release Notes`
},
preferencesChanged: {
title: 'Preference Changed',
message:
'Your menu bar preference has been saved. Please restart the ' + 'application for the change to take effect.',
},
security: {
security: 'Security',
useKeyringtoStorePassword: 'Use password storage to store password',
enabledKeyringAccessMessage:
"Standard Notes will try to use your system's password storage " +
'facility to store your password the next time you start it.',
enabledKeyringQuitNow: 'Quit Now',
enabledKeyringPostpone: 'Postpone',
},
},
contextMenu: {
learnSpelling: 'Learn Spelling',
noSuggestions: 'No Suggestions',
},
tray: {
show: 'Show',
hide: 'Hide',
quit: 'Quit',
},
extensions: {
missingExtension:
'The extension was not found on your system, possibly because it is ' +
"still downloading. If the extension doesn't load, " +
'try uninstalling then reinstalling the extension.',
unableToLoadExtension:
'Unable to load extension. Please restart the application and ' +
'try again. If the issue persists, try uninstalling then ' +
'reinstalling the extension.',
},
updates: {
automaticUpdatesEnabled: {
title: 'Automatic Updates Enabled.',
message:
'Automatic updates have been enabled. Please note that ' +
'this functionality is currently in beta, and that you are advised ' +
'to periodically check in and ensure you are running the ' +
'latest version.',
},
finishedChecking: {
title: 'Finished checking for updates.',
error(description: string) {
return (
'An issue occurred while checking for updates. ' +
'Please try again.\nIf this issue persists please contact ' +
`support with the following information: ${description}`
)
},
updateAvailable(newVersion: string) {
return (
`A new update is available (version ${newVersion}). ` +
'You can wait for the app to update itself, or manually ' +
'download and install this update.'
)
},
noUpdateAvailable(currentVersion: string) {
return `Your version (${currentVersion}) is the latest available version.`
},
},
updateReady: {
title: 'Update Ready',
message(version: string) {
return `A new update (version ${version}) is ready to install.`
},
quitAndInstall: 'Quit and Install',
installLater: 'Install Later',
noRecentBackupMessage:
'An update is ready to install, but your backups folder does not ' +
'appear to contain a recent enough backup. Please download a ' +
'backup manually before proceeding with the installation.',
noRecentBackupDetail(lastBackupDate: number | null) {
const downloadInstructions =
'You can download a backup from the Account menu ' + 'in the bottom-left corner of the app.'
const lastAutomaticBackup =
lastBackupDate === null
? 'Your backups folder is empty.'
: `Your latest automatic backup is from ${new Date(lastBackupDate).toLocaleString()}.`
return `${downloadInstructions}\n${lastAutomaticBackup}`
},
noRecentBackupChecbox: 'I have downloaded a backup, proceed with installation',
},
errorDownloading: {
title: 'Error Downloading',
message: 'An error occurred while trying to download your ' + 'update file. Please try again.',
},
unknownVersionName: 'Unknown',
},
backups: {
errorChangingDirectory(error: any): string {
return (
'An error occurred while changing your backups directory. ' +
'If this issue persists, please contact support with the following ' +
'information: \n' +
JSON.stringify(error)
)
},
},
}
}

View File

@@ -0,0 +1,42 @@
import { Strings } from './types'
import { createEnglishStrings } from './english'
import { isDev } from '../Utils/Utils'
export function createFrenchStrings(): Strings {
const fallback = createEnglishStrings()
if (!isDev()) {
/**
* Le Français est une langue expérimentale.
* Don't show it in production yet.
*/
return fallback
}
return {
appMenu: {
...fallback.appMenu,
edit: 'Édition',
view: 'Affichage',
},
contextMenu: {
learnSpelling: "Mémoriser l'orthographe",
noSuggestions: 'Aucune suggestion',
},
tray: {
show: 'Afficher',
hide: 'Masquer',
quit: 'Quitter',
},
extensions: fallback.extensions,
updates: fallback.updates,
backups: {
errorChangingDirectory(error: any): string {
return (
"Une erreur s'est produite lors du déplacement du dossier de " +
'sauvegardes. Si le problème est récurrent, contactez le support ' +
'technique (en anglais) avec les informations suivantes:\n' +
JSON.stringify(error)
)
},
},
}
}

View File

@@ -0,0 +1,70 @@
import { createEnglishStrings } from './english'
import { createFrenchStrings } from './french'
import { Strings } from './types'
import { isDev } from '../Utils/Utils'
let strings: Strings
/**
* MUST be called (once) before using any other export in this file.
* @param locale The user's locale
* @see https://www.electronjs.org/docs/api/locales
*/
export function initializeStrings(locale: string): void {
if (isDev()) {
if (strings) {
throw new Error('`strings` has already been initialized')
}
}
if (strings) {
return
}
strings = stringsForLocale(locale)
}
export function str(): Strings {
if (isDev()) {
if (!strings) {
throw new Error('tried to access strings before they were initialized.')
}
}
return strings
}
export function appMenu() {
return str().appMenu
}
export function contextMenu() {
return str().contextMenu
}
export function tray() {
return str().tray
}
export function extensions() {
return str().extensions
}
export function updates() {
return str().updates
}
export function backups() {
return str().backups
}
function stringsForLocale(locale: string): Strings {
if (locale === 'en' || locale.startsWith('en-')) {
return createEnglishStrings()
} else if (locale === 'fr' || locale.startsWith('fr-')) {
return createFrenchStrings()
}
return createEnglishStrings()
}
export const AppName = 'Standard Notes'

View File

@@ -0,0 +1,109 @@
export interface Strings {
appMenu: AppMenuStrings
contextMenu: ContextMenuStrings
tray: TrayStrings
extensions: ExtensionsStrings
updates: UpdateStrings
backups: BackupsStrings
}
interface AppMenuStrings {
edit: string
view: string
hideMenuBar: string
useThemedMenuBar: string
minimizeToTrayOnClose: string
backups: string
enableAutomaticUpdates: string
automaticUpdatesDisabled: string
disableAutomaticBackups: string
enableAutomaticBackups: string
changeBackupsLocation: string
openBackupsLocation: string
emailSupport: string
website: string
gitHub: string
slack: string
twitter: string
toggleErrorConsole: string
openDataDirectory: string
clearCacheAndReload: string
speech: string
close: string
minimize: string
zoom: string
bringAllToFront: string
checkForUpdate: string
checkingForUpdate: string
updateAvailable: string
updates: string
releaseNotes: string
openDownloadLocation: string
downloadingUpdate: string
manuallyDownloadUpdate: string
spellcheckerLanguages: string
installPendingUpdate(versionNumber: string): string
lastUpdateCheck(date: Date): string
version(number: string): string
yourVersion(number: string): string
latestVersion(number: string): string
viewReleaseNotes(versionNumber: string): string
preferencesChanged: {
title: string
message: string
}
security: {
security: string
useKeyringtoStorePassword: string
enabledKeyringAccessMessage: string
enabledKeyringQuitNow: string
enabledKeyringPostpone: string
}
}
interface ContextMenuStrings {
learnSpelling: string
noSuggestions: string
}
interface TrayStrings {
show: string
hide: string
quit: string
}
interface ExtensionsStrings {
unableToLoadExtension: string
missingExtension: string
}
interface UpdateStrings {
automaticUpdatesEnabled: {
title: string
message: string
}
finishedChecking: {
title: string
error(description: string): string
updateAvailable(newVersion: string): string
noUpdateAvailable(currentVersion: string): string
}
updateReady: {
title: string
message(version: string): string
quitAndInstall: string
installLater: string
noRecentBackupMessage: string
noRecentBackupDetail(lastBackupDate: number | null): string
noRecentBackupChecbox: string
}
errorDownloading: {
title: string
message: string
}
unknownVersionName: string
}
interface BackupsStrings {
errorChangingDirectory(error: any): string
}