Fix Locales File and Implement Locales file with app

This commit is contained in:
Preston 2020-08-05 23:39:00 -04:00
parent e1e34a7212
commit 64b877fe27
10 changed files with 275 additions and 338 deletions

View File

@ -1,51 +0,0 @@
matrix:
include:
- os: osx
osx_image: xcode9.3
language: node_js
node_js: '12'
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- os: linux
services: docker
language: node_js
node_js: '12'
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
cache:
directories:
- node_modules
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
before_install:
- |
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v2.3.1/git-lfs-$([ "$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-2.3.1.tar.gz | tar -xz -C /tmp/git-lfs --strip-components 1
export PATH="/tmp/git-lfs:$PATH"
fi
before_script:
- git lfs pull
script:
- |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
docker run --rm \
--env-file <(env | grep -v '\r' | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS|APPVEYOR_|CSC_|_TOKEN|_KEY|AWS_|STRIP|BUILD_') \
-v ${PWD}:/project \
-v ~/.cache/electron:/root/.cache/electron \
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
electronuserland/builder:wine
fi
- npm run build
before_cache:
- rm -rf $HOME/.cache/electron-builder/wine
branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"

View File

@ -133,6 +133,7 @@ const config = {
src: path.join(__dirname, '../src/'),
icons: path.join(__dirname, '../_icons/'),
images: path.join(__dirname, '../src/renderer/assets/img/'),
static: path.join(__dirname, '../static/'),
},
extensions: ['.ts', '.js', '.vue', '.json'],
},
@ -165,6 +166,13 @@ if (isDevMode) {
ignore: ['.*', 'pwabuilder-sw.js'],
},
},
{
from: path.join(__dirname, '../static'),
to: path.join(__dirname, '../dist/static'),
globOptions: {
ignore: ['.*', 'pwabuilder-sw.js'],
},
},
{
from: path.join(__dirname, '../_icons'),
to: path.join(__dirname, '../dist/web/_icons'),

View File

@ -136,6 +136,7 @@ const config = {
src: path.join(__dirname, '../src/'),
icons: path.join(__dirname, '../_icons/'),
images: path.join(__dirname, '../src/renderer/assets/img/'),
static: path.join(__dirname, '../static/'),
},
extensions: ['.js', '.vue', '.json', '.css'],
},

19
package-lock.json generated
View File

@ -3357,7 +3357,6 @@
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dev": true,
"requires": {
"sprintf-js": "~1.0.2"
},
@ -3365,8 +3364,7 @@
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
}
}
},
@ -8195,8 +8193,7 @@
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="
},
"esquery": {
"version": "1.3.1",
@ -12726,10 +12723,9 @@
"dev": true
},
"js-yaml": {
"version": "3.13.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
"dev": true,
"version": "3.14.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz",
"integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==",
"requires": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
@ -18805,6 +18801,11 @@
"integrity": "sha512-BXq3jwIagosjgNVae6tkHzzIk6a8MHFtzAdwhnV5VlvPTFxDCvIttgSiHWjdGoTJvXtmRu5HacExfdarRcFhog==",
"dev": true
},
"vue-i18n": {
"version": "8.20.0",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.20.0.tgz",
"integrity": "sha512-ZiAOoeR4d/JtKpbjipx3I80ey7cYG1ki5gQ7HwzWm4YFio9brA15BEYHjalEoBaEfzF5OBEZP+Y2MvAaWnyXXg=="
},
"vue-loader": {
"version": "15.9.3",
"resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.9.3.tgz",

View File

@ -17,6 +17,7 @@
"dateformat": "^3.0.3",
"electron-context-menu": "^2.2.0",
"jquery": "^3.5.1",
"js-yaml": "^3.14.0",
"lodash.debounce": "^4.0.8",
"lodash.isequal": "^4.5.0",
"material-design-icons": "^3.0.1",
@ -31,6 +32,7 @@
"videojs-vtt-thumbnails": "0.0.13",
"vue": "^2.6.11",
"vue-electron": "^1.0.6",
"vue-i18n": "^8.20.0",
"vue-router": "^3.3.4",
"vuex": "^3.5.1",
"xml2json": "^0.12.0",

View File

@ -3,6 +3,8 @@ import TopNav from './components/top-nav/top-nav.vue'
import SideNav from './components/side-nav/side-nav.vue'
import FtToast from './components/ft-toast/ft-toast.vue'
import $ from 'jquery'
import yaml from 'js-yaml'
import fs from 'fs'
let useElectron
let shell
@ -37,6 +39,13 @@ export default Vue.extend({
this.activateKeyboardShortcuts()
this.openAllLinksExternally()
}
try {
const doc = yaml.safeLoad(fs.readFileSync('./static/locales/en-US.yaml'))
console.log(doc)
} catch (e) {
console.log(e)
}
},
methods: {
checkThemeSettings: function () {

View File

@ -7,6 +7,9 @@ import 'material-design-icons/iconfont/material-icons.css'
import { library } from '@fortawesome/fontawesome-svg-core'
import { fas } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import VueI18n from 'vue-i18n'
import yaml from 'js-yaml'
import fs from 'fs'
const isDev = process.env.NODE_ENV === 'development'
@ -17,12 +20,51 @@ Vue.config.productionTip = isDev
library.add(fas)
Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.use(VueI18n)
fs.readdir('.', (err, dir) => {
if (err) {
console.log(err)
}
console.log(dir)
for (const filePath of dir) {
console.log(filePath)
}
})
// List of locales approved for use
const activeLocales = ['en-US']
const messages = {}
// Take active locales and load respective YAML file
activeLocales.forEach((locale) => {
try {
// File location when running in dev
const doc = yaml.safeLoad(fs.readFileSync(`static/locales/${locale}.yaml`))
messages[locale] = doc
} catch (e) {
console.log(e)
try {
// File location when compiled
const doc = yaml.safeLoad(fs.readFileSync(`${__dirname}/static/locales/${locale}.yaml`))
messages[locale] = doc
} catch (e) {
console.log(e)
}
}
})
const i18n = new VueI18n({
locale: 'en-US', // set locale
messages // set locale messages
})
/* eslint-disable-next-line */
new Vue({
el: '#app',
router,
store,
i18n,
render: h => h(App)
})

View File

@ -4,7 +4,7 @@
<h3>Subscriptions</h3>
<ft-flex-box>
<p class="message">
This part of the app is not ready yet. Come back later when progress has been made.
{{ $t("This part of the app is not ready yet. Come back later when progress has been made.") }}
</p>
</ft-flex-box>
</ft-card>

View File

@ -1,93 +0,0 @@
{
"File": "File",
"Quit": "Quit",
"Edit": "Edit",
"Undo": "Undo",
"Redo": "Redo",
"Cut": "Cut",
"Copy": "Copy",
"Paste": "Paste",
"Delete": "Delete",
"Select all": "Select all",
"View": "View",
"Reload": "Reload",
"Force Reload": "Force Reload",
"Toggle Developer Tools": "Toggle Developer Tools",
"Actual size": "Actual size",
"Zoom in": "Zoom in",
"Zoom out": "Zoom out",
"Toggle fullscreen": "Toggle fullscreen",
"Window": "Window",
"Minimize": "Minimize",
"Close": "Close",
"FreeTube": "FreeTube",
"Subscriptions": "Subscriptions",
"Featured": "Featured",
"Most Popular": "Most Popular",
"Saved": "Saved",
"Playlists": "Playlists",
"History": "History",
"Settings": "Settings",
"About": "About",
"Search / Go to URL": "Search / Go to URL",
"Search Results": "Search Results",
"Subscriber": "Subscriber",
"Subscribers": "Subscribers",
"Video": "Video",
"Videos": "Videos",
"View Full Playlist": "View Full Playlist",
"Live Now": "Live Now",
"Fetch more results": "Fetch more results",
"Fetching results. Please wait": "Fetching results. Please wait",
"Latest Subscriptions": "Latest Subscriptions",
"Save Video": "Save Video",
"Remove Saved Video": "Remove Saved Video",
"Open in YouTube": "Open in YouTube",
"Copy YouTube Link": "Copy YouTube Link",
"Open in Invidious": "Open in Invidious",
"Copy Invidious Link": "Copy Invidious Link",
"URL has been copied to the clipboard": "URL copied to clipboard",
"Found valid URL for 480p, but returned a 404. Video type might be available in the future.": "Found valid URL for 480p, but returned a 404. Video type might be available in the future.",
"Save": "Save",
"Mini Player": "Mini Player",
"View": "View",
"Views": "Views",
"Subscribe": "Subscribe",
"Unsubscribe": "Unsubscribe",
"Published on": "Published on",
"Jan": "Jan",
"Feb": "Feb",
"Mar": "Mar",
"Apr": "Apr",
"May": "May",
"Jun": "Jun",
"Jul": "Jul",
"Aug": "Aug",
"Sep": "Sep",
"Oct": "Oct",
"Nov": "Nov",
"Dec": "Dec",
"Show Comments": "Show Comments",
"Max of 100": "Max of 100",
"Recommendations": "Recommendations",
"Latest Subscriptions": "Latest Subscriptions",
"Getting Subscriptions. Please wait...": "Getting Subscriptions. Please wait…",
"Your Subscription list is currently empty. Start adding subscriptions to see them here.": "Add subscriptions to see them here.",
"Saved Videos": "Saved Videos",
"Watch History": "Watch History",
"Use Dark Theme": "Use Dark Theme",
"Import Subscriptions": "Import Subscriptions",
"Export Subscriptions": "Export Subscriptions",
"Clear History": "Clear History",
"Are you sure you want to delete your history?": "Are you sure you want to delete your history?",
"Clear Saved Videos": "Clear Favorited Videos",
"Are you sure you want to remove all saved videos?": "Are you sure you want to remove all saved videos?",
"Clear Subscriptions": "Clear Subscriptions",
"Are you sure you want to remove all subscriptions?": "Are you sure you want to remove all subscriptions?",
"Save Settings": "Save Settings",
"Yes": "Yes",
"No": "No",
"Beta": "Beta",
"This software is FOSS and released under the GNU Affero General Public License v3.0.": "This copylefted software is freely licensed AGPL-3.0.",
"Found a bug? Want to suggest a feature? Want to help out? Check out our GitHub page. Pull requests are welcome.": "Found a bug? Want to suggest a feature? Want to help out? Check out our GitHub page. Pull requests welcome."
}

View File

@ -19,7 +19,7 @@
FreeTube: FreeTube
# Currently on Subscriptions, Playlists, and History
'This part of the app is not ready yet. Come back later when progress has been made.': >
'This part of the app is not ready yet. Come back later when progress has been made.'
This part of the app is not ready yet. Come back later when progress has been made.
# Webkit Menu Bar
File: File
@ -48,12 +48,15 @@ Forward: Forward
# Search Bar
Search / Go to URL: Search / Go to URL
# In Filter Button
Search Filters:
Search Filters: Search Filters
Sort By:
Sort By: Sort By
Most Relevant: Most Relevant
Rating: Rating
Upload Date: Upload Date
View Count: View Count
Time:
Time: Time
Any Time: Any Time
Last Hour: Last Hour
@ -61,11 +64,13 @@ Search / Go to URL: Search / Go to URL
This Week: This Week
This Month: This Month
This Year: This Year
Type:
Type: Type
All Types: All Types
Videos: Videos
Channels: Channels
#& Playlists
Duration:
Duration: Duration
All Durations: All Durations
Short (< 4 minutes): Short (< 4 minutes)
@ -75,16 +80,17 @@ Search / Go to URL: Search / Go to URL
Fetching results. Please wait: Fetching results. Please wait
Fetch more results: Fetch more results
# Sidebar
Subscriptions: Subscriptions
Subscriptions:
# On Subscriptions Page
Subscriptions: Subscriptions
Latest Subscriptions: Latest Subscriptions
'Your Subscription list is currently empty. Start adding subscriptions to see them here.': >
'Your Subscription list is currently empty. Start adding subscriptions to see them here.'
Your Subscription list is currently empty. Start adding subscriptions to see them here.
'Getting Subscriptions. Please wait...': 'Getting Subscriptions. Please wait…'
'Getting Subscriptions. Please wait...': Getting Subscriptions. Please wait…
Live Now: Live Now
Published: Published
Published:
Jan: Jan
Feb: Feb
Mar: Mar
@ -112,32 +118,44 @@ Subscriptions: Subscriptions
Featured: Featured
Most Popular: Most Popular
Playlists: Playlists
History: History
History:
# On History Page
History: History
Watch History: Watch History
Settings: Settings
Settings:
# On Settings Page
Settings: Settings
General Settings:
General Settings: General Settings
Fallback to Non-Preferred Backend on Failure: Fallback to Non-Preferred Backend on Failure
Enable Search Suggestions: Enable Search Suggestions
Default Landing Page: Default Landing Page
Perferred API Backend:
Perferred API Backend: Perferred API Backend
Local API: Local API
Invidious API: Invidious API
Video View Type:
Video View Type: Video View Type
Grid: Grid
List: List
Thumbnail Preference:
Thumbnail Preference: Thumbnail Preference
Default: Default
Beginning: Beginning
Middle: Middle
End: End
'Invidious Instance (Default is https://invidio.us)': 'Invidious Instance (Default is https://invidio.us)'
'Invidious Instance (Default is https://invidio.us)': Invidious Instance (Default is https://invidio.us)
Region for Trending: Region for Trending
#! List countries
Theme Settings:
Theme Settings: Theme Settings
Match Top Bar with Main Color: Match Top Bar with Main Color
Base Theme:
Base Theme: Base Theme
Black: Black
Dark: Dark
Light: Light
Main Color Theme:
Main Color Theme: Main Color Theme
Red: Red
Pink: Pink
@ -157,18 +175,24 @@ Settings: Settings
Deep Orange: Deep Orange
Secondary Color Theme: Secondary Color Theme
#* Main Color Theme
Player Settings:
Player Settings: Player Settings
Force Local Backend for Legacy Formats: Force Local Backend for Legacy Formats
Remember History: Remember History
Play Next Video: Play Next Video
Turn on Subtitles by Default: Turn on Subtitles by Default
Autoplay Videos: Autoplay Videos
Proxy Videos Through Invidious: Proxy Videos Through Invidious
Autoplay Playlists: Autoplay Playlists
Enable Theatre Mode by Default: Enable Theatre Mode by Default
Default Volume: Default Volume
Default Playback Rate: Default Playback Rate
Default Video Format:
Default Video Format: Default Video Format
Dash Formats: Dash Formats
Legacy Formats: Legacy Formats
Audio Formats: Audio Formats
Default Quality:
Default Quality: Default Quality
Auto: Auto
144p: 144p
@ -180,32 +204,69 @@ Settings: Settings
1440p: 1440p
4k: 4k
8k: 8k
Subscription Settings:
Subscription Settings: Subscription Settings
Hide Videos on Watch: Hide Videos on Watch
Subscriptions Export Format:
Subscriptions Export Format: Subscriptions Export Format
#& Freetube
Newpipe: Newpipe
OPML: OPML
Manage Subscriptions: Manage Subscriptions
Import Subscriptions: Import Subscriptions
Export Subscriptions: Export Subscriptions
How do I import my subscriptions?: How do I import my subscriptions?
Advanced Settings:
Advanced Settings: Advanced Settings
Enable Debug Mode (Prints data to the console): Enable Debug Mode (Prints data to the console)
'Proxy Address (Example: SOCKS5://127.0.0.1:9050 )': 'Proxy Address (Example: SOCKS5://127.0.0.1:9050 )'
'Clicking "TEST PROXY" button will send a request to https://ipinfo.io/json': >
Clicking "TEST PROXY" button will send a request to https://ipinfo.io/json
Use Tor / Proxy for API calls: Use Tor / Proxy for API calls
TEST PROXY: TEST PROXY
#& Invidious Instance (Default is https://invidio.us)
See Public Instances: See Public Instances
Clear History:
Clear History: Clear History
# On Click
Are you sure you want to delete your history?: Are you sure you want to delete your history?
#& Yes
#& No
Clear Subscriptions:
Clear Subscriptions: Clear Subscriptions
# On Click
Are you sure you want to remove all subscriptions?: Are you sure you want to remove all subscriptions?
#& Yes
#& No
About:
#On About page
About: About
#On About Page
#& About
'This software is FOSS and released under the GNU Public License v3+.': >
'This copylefted software is freely licensed GPLv3+.'
This copylefted software is freely licensed GPLv3+.
'Found a bug? Want to suggest a feature? Want to help out? Check out our GitHub page. Pull requests are welcome.': >-
'Found a bug? Want to suggest a feature? Want to help out? Check out our GitHub
page. Pull requests welcome.'
Found a bug? Want to suggest a feature? Want to help out? Check out our GitHub
page. Pull requests welcome.
Thank you very much to the People and Projects that make FreeTube possible!: >
Thank you very much to the People and Projects that make FreeTube possible!
'Want to chat? Join our Element / Matrix Server . Please check the rules before joining.': >
'Want to chat? Join our Element / Matrix Server . Please check the rules before joining.'
Want to chat? Join our Element / Matrix Server . Please check the rules before joining.
'Looking for help? Check out our Wiki page.': 'Looking for help? Check out our Wiki page.'
'Looking for help? Check out our Wiki page.': Looking for help? Check out our Wiki page.
Check out our Firefox extension!: Check out our Firefox extension!
'If you enjoy using FreeTube, consider donating via Liberapay or through our Bitcoin address.': >
'If you enjoy using FreeTube, consider donating via Liberapay or through our Bitcoin address.'
If you enjoy using FreeTube, consider donating via Liberapay or through our Bitcoin address.
#~ 'BTC: 1Lih7Ho5gnxb1CwPD4o59ss78pwo2T91eS'
Latest FreeTube News: Latest FreeTube News
#On Channel Page
Subscriber: Subscriber
Subscribers: Subscribers
@ -213,11 +274,14 @@ Subscribe: Subscribe
Unsubscribe: Unsubscribe
Video: Video
#& Videos
Videos:
#& Sort By
Sort By:
Newest: Newest
Oldest: Oldest
#& Most Popular
#& Playlists
Playlist:
#& About
Channel Description: Channel Description
Featured Channels: Featured Channels
@ -225,6 +289,7 @@ Video: Video
View Full Playlist: View Full Playlist
# On Channel Playlist Page
Share Playlist:
Share Playlist: Share Playlist
Copy YouTube Link: Copy YouTube Link
Open in YouTube: Open in YouTube
@ -234,17 +299,19 @@ Share Playlist: Share Playlist
# On Video Watch Page
#* Published
#& Views
Change Format:
Change Format: Change Format
Use Dash Formats: Use Dash Formats
Use Legacy Formats: Use Legacy Formats
Use Audio Formats: Use Audio Formats
Share:
Share: Share
Copy Link: Copy Link
Open Link: Open Link
Copy Embed: Copy Embed
Open Embed: Open Embed
# On Click
URL has been copied to the clipboard: URL copied to clipboard
URL has been copied to the clipboard: URL has been copied to clipboard
Mini Player: Mini Player
Click to View Comments: Click to View Comments
Show Comments: Show Comments
@ -264,54 +331,5 @@ Playing previous video: Playing previous video
Playing next video in 5 seconds. Click to cancel: Playing next video in 5 seconds. Click to cancel
Canceled next video autoplay: Canceled next video autoplay
# Currently Not Added from Live
# On Settings Page
# General Settings
Default Landing Page: Default Landing Page
#& Subscriptions
#& Trending
#& Most Popular
#& Playlists
#& History
Region for Trending: Region for Trending
#! List countries
# Player Settings
Remember History: Remember History
Autoplay Videos: Autoplay Videos
Autoplay Playlists: Autoplay Playlists
Play Next Video: Play Next Video
Turn on Subtitles by Default: Turn on Subtitles by Default
Force Local backend for legacy formats: Force Local backend for legacy formats
Proxy Videos Through Invidious: Proxy Videos Through Invidious
# Subscription Settings
Hide Videos on Watch: Hide Videos on Watch
Subscriptions Export Format: Subscriptions Export Format
#& Freetube
Newpipe: Newpipe
OPML: OPML
Manage Subscriptions: Manage Subscriptions
Import Subscriptions: Import Subscriptions
Export Subscriptions: Export Subscriptions
How do I import my subscriptions?: How do I import my subscriptions?
# Advanced Settings
Enable Debug Mode (Prints data to the console): Enable Debug Mode (Prints data to the console)
'Proxy Address (Example: SOCKS5://127.0.0.1:9050 )': 'Proxy Address (Example: SOCKS5://127.0.0.1:9050 )'
'Clicking "TEST PROXY" button will send a request to https://ipinfo.io/json': >
'Clicking "TEST PROXY" button will send a request to https://ipinfo.io/json'
Use Tor / Proxy for API calls: Use Tor / Proxy for API calls
TEST PROXY: TEST PROXY
#& Invidious Instance (Default is https://invidio.us)
See Public Instances: See Public Instances
Clear History: Clear History
# On Click
Are you sure you want to delete your history?: Are you sure you want to delete your history?
'Yes': 'Yes'
'No': 'No'
Clear Subscriptions: Clear Subscriptions
# On Click
Are you sure you want to remove all subscriptions?: Are you sure you want to remove all subscriptions?
#& Yes
#& No
Save Settings: Save Settings
# On About Page
Latest FreeTube News: Latest FreeTube News
Yes: Yes
No: No