More translation stuff

pull/9/head
aandrew-me 3 years ago
parent 183693a4b5
commit d55fba8eb3

1
.gitignore vendored

@ -7,3 +7,4 @@ test.js
todo.txt
ffmpeg
ffmpeg.exe
crowdin.yml

@ -27,8 +27,8 @@ A modern GUI video downloader supporting [hundreds of sites](https://github.com/
## Screenshots
![image](https://user-images.githubusercontent.com/66430340/187023169-e4cd9b81-1968-4758-85b7-2287808d914d.png)
![image](https://user-images.githubusercontent.com/66430340/187023235-45095832-a357-4323-8cdd-50cfd6305d29.png)
![image](https://user-images.githubusercontent.com/66430340/188084613-706262fd-db82-403f-8dad-03dd2a50cfe9.png)
![image](https://user-images.githubusercontent.com/66430340/188084389-5e060523-07c3-42db-b282-7f446cb257fa.png)
<!--![ss](https://user-images.githubusercontent.com/66430340/181747909-f16e30dc-a7c3-40cb-876b-54f0ea8d4e42.jpg)-->
<!--![ss2](https://user-images.githubusercontent.com/66430340/181747920-4df80914-278f-4350-9328-015e9e0bcf16.jpg) -->

@ -9,6 +9,10 @@ body{
}
h1{
margin-top:0;
display: inline-block;
}
#version{
margin:5px;
}
input[type="text"]{
padding:10px;
@ -59,3 +63,13 @@ input[type="checkbox"]{
background-color: rgb(56, 209, 56);
cursor: pointer;
}
select {
padding: 15px;
background-color: rgb(127, 253, 127);
border: none;
border-radius: 8px;
cursor: pointer;
font-size: large;
margin: 8px;
outline: none;
}

@ -0,0 +1,42 @@
// Converts the csv translation file to json and puts in translations folder
// Language of output file
const language = "ru"
const { readFileSync, writeFileSync } = require("fs");
let csvFile = readFileSync("input.csv", { encoding: "utf-8" });
let result = "";
let count = 0;
let size = csvFile.length;
let index = 0
result += "{";
for (let letter of csvFile) {
if (letter === `"`) {
count++;
if (count < 4) {
result += letter;
index ++;
} else {
index ++;
if (index == size-1){
result += `${letter}`;
}
else{
result += `${letter},`;
}
count = 0;
}
} else {
result += letter;
index++;
}
}
result += "}";
writeFileSync(`translations/${language}.json`, result)
console.log(`Converted and saved to translations/${language}.json`)

@ -1,55 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>me.aandrew.ytdownloader</id>
<name>Youtube Downloader</name>
<name>Youtube Downloader Plus</name>
<summary>Download videos and audios from Youtube and other sites</summary>
<description>
<p>YtDownloader lets you download videos and audios of different qualities from Youtube with high speed. It also supports hundreds of other sites including the popular ones but not limited to Facebook, Instagram, Tiktok, Twitter.</p>
<p>✅ Supports Light/Dark mode</p>
<p>YtDownloader lets you download videos and audios of different qualities from Youtube with high speed. It also supports hundreds of other sites including the popular ones but not limited to Facebook, Instagram, Tiktok, Twitter, Twitch and so on.</p>
<p>✅ Supports Light/Dark/Transparent mode</p>
<p>✅ Supports high quality video resolutions</p>
<p>✅ Supports downloading particular ranges</p>
<p>✅ Completely free and open source</p>
<p>✅ Fast download speeds</p>
</description>
<project_license>MIT</project_license>
<metadata_license>CC0-1.0</metadata_license>
<screenshots>
<screenshot type="default">
<image>https://user-images.githubusercontent.com/66430340/181747909-f16e30dc-a7c3-40cb-876b-54f0ea8d4e42.jpg</image>
<image>https://user-images.githubusercontent.com/66430340/188084613-706262fd-db82-403f-8dad-03dd2a50cfe9.png</image>
</screenshot>
<screenshot>
<image>https://user-images.githubusercontent.com/66430340/181747920-4df80914-278f-4350-9328-015e9e0bcf16.jpg</image>
<image>https://user-images.githubusercontent.com/66430340/188084389-5e060523-07c3-42db-b282-7f446cb257fa.png</image>
</screenshot>
</screenshots>
<url type="homepage">https://github.com/aandrew-me/ytDownloader</url>
<content_rating type="oars-1.1">
<content_attribute id="violence-cartoon">none</content_attribute>
<content_attribute id="violence-fantasy">none</content_attribute>
<content_attribute id="violence-realistic">none</content_attribute>
<content_attribute id="violence-bloodshed">none</content_attribute>
<content_attribute id="violence-sexual">none</content_attribute>
<content_attribute id="violence-desecration">none</content_attribute>
<content_attribute id="violence-slavery">none</content_attribute>
<content_attribute id="violence-worship">none</content_attribute>
<content_attribute id="drugs-alcohol">none</content_attribute>
<content_attribute id="drugs-narcotics">none</content_attribute>
<content_attribute id="drugs-tobacco">none</content_attribute>
<content_attribute id="sex-nudity">none</content_attribute>
<content_attribute id="sex-themes">none</content_attribute>
<content_attribute id="sex-homosexuality">none</content_attribute>
<content_attribute id="sex-prostitution">none</content_attribute>
<content_attribute id="sex-adultery">none</content_attribute>
<content_attribute id="sex-appearance">none</content_attribute>
<content_attribute id="language-profanity">none</content_attribute>
<content_attribute id="language-humor">none</content_attribute>
<content_attribute id="language-discrimination">none</content_attribute>
<content_attribute id="social-chat">none</content_attribute>
<content_attribute id="social-info">none</content_attribute>
<content_attribute id="social-audio">none</content_attribute>
<content_attribute id="social-location">none</content_attribute>
<content_attribute id="social-contacts">none</content_attribute>
<content_attribute id="money-purchasing">none</content_attribute>
<content_attribute id="money-gambling">none</content_attribute>
</content_rating>
<content_rating type="oars-1.1"/>
<releases>
<release version="3.1.0" date="2022-08-31"/>

@ -8,20 +8,23 @@
<title>About</title>
<link rel="stylesheet" href="../assets/css/extra.css">
<!-- Translating -->
<script>window.i18n = new (require('../translations/i18n'));</script>
</head>
<body>
<a id="back">Homepage</a>
<h1>ytDownloader <span id="version"></span></h1>
<h1>ytDownloader </h1><span id="version"></span>
<p>ytDownloader lets you download videos (and sometimes audios) from hundreds of sites like Youtube, Facebook, Instagram, Tiktok, Twitter and so on
</p>
<p id="txt1">ytDownloader lets you download videos (and sometimes audios) from hundreds of sites like Youtube, Facebook, Instagram, Tiktok, Twitter and so on</p>
<p>It's a Free and Open Source app built on top of Node.js and Electron. yt-dlp has been used for downloading</p>
<p id="txt2">It's a Free and Open Source app built on top of Node.js and Electron. yt-dlp has been used for downloading</p>
<p>Source Code is available <a id="sourceLink">here</a></p>
<span id="txt3">Source Code is available </span><a id="sourceLink">here</a>
<script>
require("../src/translate_about")
const { ipcRenderer, shell } = require("electron")
ipcRenderer.send("get-version")
@ -29,11 +32,13 @@
document.getElementById("version").textContent = version;
})
document.getElementById("back").addEventListener("click", ()=>{
ipcRenderer.send("close-secondary") })
document.getElementById("sourceLink").addEventListener("click", ()=>{
document.getElementById("back").addEventListener("click", () => {
ipcRenderer.send("close-secondary")
})
document.getElementById("sourceLink").addEventListener("click", () => {
shell.openExternal("https://github.com/aandrew-me/ytDownloader")
})
</script>
</body>

@ -18,7 +18,7 @@
<div id="popupBox">
<div id="popup">
<p>yt-dlp is being downloaded</p>
<p>Please wait, yt-dlp is being downloaded</p>
<svg id="popupSvg" version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100"
enable-background="new 0 0 0 0" xml:space="preserve">
@ -85,7 +85,7 @@
<br>
<input type="hidden" name="url" class="url" id="url">
<button class="submitBtn" id="videoDownload">Download</button>
<button id="advancedToggle" onClick ="advancedToggle()">Advanced</button>
<button id="advancedToggle" onClick ="advancedToggle()">More options</button>
</div>
<div id="audioList">

@ -1,61 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Preferences</title>
<title id="title">Preferences</title>
<link rel="stylesheet" href="../assets/css/extra.css">
<!-- Translating -->
<script>window.i18n = new (require('../translations/i18n'));</script>
</head>
<body>
<a id="back">Homepage</a>
<h1>Preferences</h1>
<strong>Download location</strong>
<p>Default location: <span id="path"></span></p>
<h1 id="preferences">Preferences</h1>
<br><br>
<strong id="dlText">Download location</strong>
<br><br>
<span id="clText">Current download location - </span><span id="path"></span>
<br><br>
<button id="selectLocation">Select Download Location</button>
<p id="msg"></pid>
<p id="msg">
</pid>
<p>Enable transparent dark (only Linux, needs restart)<input type="checkbox" id="enableTransparent"></p>
<span id="transparentText">Enable transparent dark mode(only Linux, needs restart)</span><input type="checkbox"
id="enableTransparent">
<script>
let downloadPath = localStorage.getItem("downloadPath")
getId("path").textContent = downloadPath
<br><br>
<label>Select Language</label>
<select id="select" onchange="changeLanguage()">
<option value="en">English</option>
<option value="ru">Русский</option>
</select>
const { ipcRenderer, dialog } = require("electron")
function getId(id){
return document.getElementById(id)
}
<script>
let downloadPath = localStorage.getItem("downloadPath")
getId("path").textContent = downloadPath
getId("back").addEventListener("click", ()=>{
ipcRenderer.send("close-secondary")
})
const { ipcRenderer, dialog } = require("electron")
function getId(id) {
return document.getElementById(id)
}
getId("selectLocation").addEventListener("click", ()=>{
ipcRenderer.send("select-location", "")
})
getId("back").addEventListener("click", () => {
ipcRenderer.send("close-secondary")
})
ipcRenderer.on("downloadPath", (event, downloadPath)=>{
console.log(downloadPath);
localStorage.setItem("downloadPath", downloadPath)
getId("path").textContent = downloadPath
})
getId("selectLocation").addEventListener("click", () => {
ipcRenderer.send("select-location", "")
})
const enabledTransparent = getId("enableTransparent")
enabledTransparent.addEventListener("change", (event)=>{
if (enabledTransparent.checked){
localStorage.setItem("enabledTransparent", "true")
ipcRenderer.on("downloadPath", (event, downloadPath) => {
console.log(downloadPath);
localStorage.setItem("downloadPath", downloadPath)
getId("path").textContent = downloadPath
})
const enabledTransparent = getId("enableTransparent")
enabledTransparent.addEventListener("change", (event) => {
if (enabledTransparent.checked) {
localStorage.setItem("enabledTransparent", "true")
}
else {
localStorage.setItem("enabledTransparent", "false")
}
})
const localEnabledTransparent = localStorage.getItem("enabledTransparent")
if (localEnabledTransparent == "true") {
enabledTransparent.checked = true
}
const language = localStorage.getItem("language")
if (language) {
getId("select").value = language
}
else{
localStorage.setItem("enabledTransparent", "false")
function changeLanguage() {
const language = getId("select").value
localStorage.setItem("language", language)
}
})
const localEnabledTransparent = localStorage.getItem("enabledTransparent")
if (localEnabledTransparent == "true"){
enabledTransparent.checked = true
}
</script>
require("../src/translate_preferences")
</script>
</body>
</html>

@ -0,0 +1,24 @@
"Click to paste video URL or ID [Ctrl + V]":"Нажмите, чтобы вставить URL-адрес или идентификатор видео [Ctrl + V]"
"Preferences":"Настройки"
"About":"О программе"
"Download location":"Папка загрузки"
"Current download location - ":"Текущее место загрузки - "
"Enable transparent dark mode(only Linux, needs restart)":"Включить прозрачный темный режим (только для Linux, требуется перезагрузка)"
"Please wait, yt-dlp is being downloaded":"Пожалуйста, подождите, yt-dlp загружается"
"Video":"Видео"
"Audio":"Аудио"
"Title ":"Название "
"Select Format ":"Выберите формат "
"Download":"Скачать"
"Select Download Location":"Выберите место загрузки"
"More options":"Дополнительные опции"
"Start":"Начало"
"Download particular time-range":"Скачать определенную часть"
"End":"Конец"
"If kept empty, it will start from the beginning":"Если оставить пустым, оно начнется с начала"
"If kept empty, it will be downloaded to the end":"Если оставить пустым, оно будет загружено до конца"
"Homepage":"Главная страница"
"ytDownloader lets you download videos (and sometimes audios) from hundreds of sites like Youtube, Facebook, Instagram, Tiktok, Twitter and so on":"ytDownloader позволяет вам загружать видео (и иногда аудио) с сотен таких сайтов, как Youtube, Facebook, Instagram, Tiktok, Twitter и т.д"
"It's a Free and Open Source app built on top of Node.js and Electron. yt-dlp has been used for downloading":"Это бесплатное приложение с открытым исходным кодом, созданное поверх Node.js и Electron. yt-dlp используется для загрузки"
"Source Code is available":"Исходный код доступен"
"here":"здесь"
Can't render this file because it contains an unexpected character in line 1 and column 43.

@ -0,0 +1,9 @@
// Converts translate.json file to translate.csv file
const fs = require("fs")
let inputFile = JSON.parse(fs.readFileSync('translations/translate.json', 'utf8'))
fs.writeFileSync("translate.csv", "")
for (const [key, value] of Object.entries(inputFile)){
fs.appendFileSync("translate.csv", key + "\n")
}

@ -16,7 +16,7 @@ function createWindow() {
transparent: isTransparent,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
contextIsolation: false
},
});
@ -47,15 +47,6 @@ app.whenReady().then(() => {
ipcMain.on("get-version", () => {
const version = app.getVersion();
secondaryWindow.webContents.send("version", version);
console.log("Sent " + version);
});
ipcMain.on("get-locale", () => {
const locale = app.getLocale();
win.webContents.send("locale", locale);
if (secondaryWindow) {
secondaryWindow.webContents.send("locale", locale);
}
});
ipcMain.on("load-page", (event, file) => {

@ -5,7 +5,7 @@
"yt-dlp-wrap-extended": "^2.3.12"
},
"name": "ytdownloader",
"version": "3.1.1",
"version": "3.2.0",
"main": "main.js",
"scripts": {
"start": "electron .",

@ -7,3 +7,8 @@ function querySelector(element){
var i18n = new(require('../translations/i18n'))
// Translating texts
getId("back").textContent = i18n.__("Homepage")
getId("txt1").textContent = i18n.__("ytDownloader lets you download videos (and sometimes audios) from hundreds of sites like Youtube, Facebook, Instagram, Tiktok, Twitter and so on")
getId("txt2").textContent = i18n.__("It's a Free and Open Source app built on top of Node.js and Electron. yt-dlp has been used for downloading")
getId("txt3").textContent = i18n.__("Source Code is available ")
getId("sourceLink").textContent = i18n.__("here")

@ -15,7 +15,7 @@ getId("title").textContent = i18n.__("Title ")
querySelector("#videoList label").textContent = i18n.__("Select Format ")
getId("videoDownload").textContent = i18n.__("Download")
getId("audioDownload").textContent = i18n.__("Download")
getId("advancedToggle").textContent = i18n.__("Advanced")
getId("advancedToggle").textContent = i18n.__("More options")
getId("rangeText").textContent= i18n.__("Download particular time-range")
getId("startTime").title = i18n.__("If kept empty, it will start from the beginning")
getId("endTime").title = i18n.__("If kept empty, it will be downloaded to the end")

@ -7,3 +7,10 @@ function querySelector(element){
var i18n = new(require('../translations/i18n'))
// Translating texts
getId("title").textContent = i18n.__("Preferences")
getId("back").textContent = i18n.__("Homepage")
getId("dlText").textContent = i18n.__("Download location")
getId("clText").innerHTML = i18n.__("Current download location - ")
getId("selectLocation").textContent = i18n.__("Select Download Location")
getId("transparentText").textContent = i18n.__("Enable transparent dark mode(only Linux, needs restart)")
getId("preferences").textContent = i18n.__("Preferences")

@ -0,0 +1,25 @@
Click to paste video URL or ID [Ctrl + V]
Preferences
About
Download location
Current download location -
Enable transparent dark mode(only Linux, needs restart)
Please wait, yt-dlp is being downloaded
Video
Audio
Title
Select Format
Download
Select Download Location
More options
Start
Select Language
Download particular time-range
End
If kept empty, it will start from the beginning
If kept empty, it will be downloaded to the end
Homepage
ytDownloader lets you download videos (and sometimes audios) from hundreds of sites like Youtube, Facebook, Instagram, Tiktok, Twitter and so on
It's a Free and Open Source app built on top of Node.js and Electron. yt-dlp has been used for downloading
Source Code is available
here
1 Click to paste video URL or ID [Ctrl + V]
2 Preferences
3 About
4 Download location
5 Current download location -
6 Enable transparent dark mode(only Linux, needs restart)
7 Please wait, yt-dlp is being downloaded
8 Video
9 Audio
10 Title
11 Select Format
12 Download
13 Select Download Location
14 More options
15 Start
16 Select Language
17 Download particular time-range
18 End
19 If kept empty, it will start from the beginning
20 If kept empty, it will be downloaded to the end
21 Homepage
22 ytDownloader lets you download videos (and sometimes audios) from hundreds of sites like Youtube, Facebook, Instagram, Tiktok, Twitter and so on
23 It's a Free and Open Source app built on top of Node.js and Electron. yt-dlp has been used for downloading
24 Source Code is available
25 here

@ -1,34 +1,39 @@
const path = require("path")
const electron = require('electron')
const fs = require('fs');
const { ipcRenderer } = require("electron");
const path = require("path");
const electron = require("electron");
const fs = require("fs");
let loadedLanguage;
let userSelectedLanguage = false;
let locale;
if(electron.app){
locale = app.getLocale()
if (electron.app) {
locale = electron.app.getLocale();
} else {
locale = navigator.language
}
else{
ipcRenderer.send("get-locale")
ipcRenderer.once("locale", (event, locale)=>{
locale = locale
})
// Check localstorage for language
if (localStorage.getItem("language")){
locale = localStorage.getItem("language")
userSelectedLanguage = true;
}
module.exports = i18n;
function i18n() {
if(fs.existsSync(path.join(__dirname, locale + '.json'))) {
loadedLanguage = JSON.parse(fs.readFileSync(path.join(__dirname, locale + '.json'), 'utf8'))
}
else {
loadedLanguage = JSON.parse(fs.readFileSync(path.join(__dirname, 'en.json'), 'utf8'))
}
if (fs.existsSync(path.join(__dirname, locale + ".json"))) {
loadedLanguage = JSON.parse(
fs.readFileSync(path.join(__dirname, locale + ".json"), "utf8")
);
} else {
loadedLanguage = JSON.parse(
fs.readFileSync(path.join(__dirname, "main.json"), "utf8")
);
}
}
i18n.prototype.__ = function(phrase) {
let translation = loadedLanguage[phrase]
if(translation === undefined) {
translation = phrase
}
return translation
}
i18n.prototype.__ = function (phrase) {
let translation = loadedLanguage[phrase];
if (translation === undefined) {
translation = phrase;
}
return translation;
};

@ -0,0 +1,25 @@
{"Click to paste video URL or ID [Ctrl + V]":"Нажмите, чтобы вставить URL-адрес или идентификатор видео [Ctrl + V]",
"Preferences":"Настройки",
"About":"О программе",
"Download location":"Папка загрузки",
"Current download location - ":"Текущее место загрузки - ",
"Enable transparent dark mode(only Linux, needs restart)":"Включить прозрачный темный режим (только для Linux, требуется перезагрузка)",
"Please wait, yt-dlp is being downloaded":"Пожалуйста, подождите, yt-dlp загружается",
"Video":"Видео",
"Audio":"Аудио",
"Title ":"Название ",
"Select Format ":"Выберите формат ",
"Download":"Скачать",
"Select Download Location":"Выберите место загрузки",
"More options":"Дополнительные опции",
"Start":"Начало",
"Download particular time-range":"Скачать определенную часть",
"End":"Конец",
"If kept empty, it will start from the beginning":"Если оставить пустым, оно начнется с начала",
"If kept empty, it will be downloaded to the end":"Если оставить пустым, оно будет загружено до конца",
"Homepage":"Главная страница",
"ytDownloader lets you download videos (and sometimes audios) from hundreds of sites like Youtube, Facebook, Instagram, Tiktok, Twitter and so on":"ytDownloader позволяет вам загружать видео (и иногда аудио) с сотен таких сайтов, как Youtube, Facebook, Instagram, Tiktok, Twitter и т.д",
"It's a Free and Open Source app built on top of Node.js and Electron. yt-dlp has been used for downloading":"Это бесплатное приложение с открытым исходным кодом, созданное поверх Node.js и Electron. yt-dlp используется для загрузки",
"Source Code is available":"Исходный код доступен",
"here":"здесь"
}

@ -3,17 +3,18 @@
"Preferences":"",
"About":"",
"Download location":"",
"Default location:" : "",
"Enable transparent dark (only Linux, needs restart)" : "",
"yt-dlp is being downloaded" : "",
"Current download location - " : "",
"Enable transparent dark mode(only Linux, needs restart)" : "",
"Please wait, yt-dlp is being downloaded" : "",
"Video": "",
"Audio": "",
"Title " : "",
"Select Format ": "",
"Download":"",
"Select Download Location":"",
"Advanced": "",
"More options": "",
"Start":"",
"Select Language":"",
"Download particular time-range":"",
"End":"",
"If kept empty, it will start from the beginning":"",
Loading…
Cancel
Save