Skip to content

Localization #347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const ngrok = require('ngrok');
const commandExists = require('command-exists');
const errorHandler = require('errorhandler');
const jsHelpers = require('./lib/helpers/js-helpers');
const { I18n } = require('i18n');

/** FOR FINDING ERRANT LOGS **/
if(process.env.SHOW_LOG_LOCATION == 'true' || 2 == 1){
Expand Down Expand Up @@ -138,9 +139,19 @@ if(cluster.isMaster){

console.log('CONNECTED TO DATABASE AT: ' + mongoUri + '\n');

const i18n = new I18n({
locales: ['en', 'ar'],
defaultLocale: 'ar',
queryParameter: 'lang',
directory: path.join(__dirname, 'locales')
});

i18n.setLocale('ar');

/** create express app **/
const app = express();

app.use(i18n.init);
app.use(favicon(path.join(__dirname, 'public', 'images/favicon.ico')));

/*
Expand Down
22 changes: 22 additions & 0 deletions locales/ar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"Introducing {{brandName}}": "نقدم لكم {{brandName}}",
"An open-source YouTube alternative powered by Node.js": "بديل مفتوح المصدر ليوتيوب مدعوم بNode.js",
"No Email Required ": "ليس هنالك داعٍ للإيميل ",
"Start your channel on {{brandName}}": "إبدأ ٌقناتك في {{brandName}}",
"without having to verify your email": "ليس عليك أن تؤكد إيميلك",
"Video, Audio, Images ": "فيديو, صوت, صور ",
"Over 30 file formats are supported": "أكثر من 30 نوع ملفات مدعوم",
"between video, audio and image uploads": "بين الفيديو، والصوت والصور",
"100% Open Source ": "100% مفتوح المصدر ",
"Create your own {{brandName}} instance": "إنشئ {{brandName}} الآن",
"in just minutes following our tutorials": "in just minutes following our tutorials",
"{{channelAmount}} Channels ": "{{channelAmount}} Channels ",
"The number of creators who have": "The number of creators who have",
"chosen {{brandName}} for their media hosting": "chosen {{brandName}} for their media hosting",
"{{mediaAmount}} Uploads ": "{{mediaAmount}} Uploads ",
"The number of times creators have": "The number of times creators have",
"chosen {{brandName}} for their content hosting": "chosen {{brandName}} for their content hosting",
"{{viewAmount}} Views ": "{{viewAmount}} Views ",
"The number of times people have": "The number of times people have",
"enjoyed the innovative new platform": "enjoyed the innovative new platform"
}
22 changes: 22 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"Introducing {{brandName}}": "Introducing {{brandName}}",
"An open-source YouTube alternative powered by Node.js": "An open-source YouTube alternative powered by Node.js",
"No Email Required ": "No Email Required ",
"Start your channel on {{brandName}}": "Start your channel on {{brandName}}",
"without having to verify your email": "without having to verify your email",
"Video, Audio, Images ": "Video, Audio, Images ",
"Over 30 file formats are supported": "Over 30 file formats are supported",
"between video, audio and image uploads": "between video, audio and image uploads",
"100% Open Source ": "100% Open Source ",
"Create your own {{brandName}} instance": "Create your own {{brandName}} instance",
"in just minutes following our tutorials": "in just minutes following our tutorials",
"{{channelAmount}} Channels ": "{{channelAmount}} Channels ",
"The number of creators who have": "The number of creators who have",
"chosen {{brandName}} for their media hosting": "chosen {{brandName}} for their media hosting",
"{{mediaAmount}} Uploads ": "{{mediaAmount}} Uploads ",
"The number of times creators have": "The number of times creators have",
"chosen {{brandName}} for their content hosting": "chosen {{brandName}} for their content hosting",
"{{viewAmount}} Views ": "{{viewAmount}} Views ",
"The number of times people have": "The number of times people have",
"enjoyed the innovative new platform": "enjoyed the innovative new platform"
}
88 changes: 86 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nodetube",
"version": "1.0.0",
"name": "NodeTube",
"version": "1.1.0",
"description": "Video, audio and image hosting",
"repository": {
"type": "git",
Expand Down Expand Up @@ -68,6 +68,7 @@
"get-audio-duration": "^2.0.0",
"get-video-duration": "^1.0.3",
"heroku-ssl-redirect": "0.0.4",
"i18n": "^0.13.2",
"intl-messageformat": "^1.3.0",
"ipstack": "^0.1.1",
"javascript-time-ago": "^0.4.15",
Expand Down
2 changes: 1 addition & 1 deletion views/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ html

block extra_js


// TODO: dir='RTL" if localization is ar or any other RTL languages
body(style="overflow-x:hidden;touch-action: manipulation;" id="body" class="dark-mode")


Expand Down
40 changes: 20 additions & 20 deletions views/public/home.pug
Original file line number Diff line number Diff line change
Expand Up @@ -63,41 +63,41 @@ block content
//.landingVideo(style="margin-top:0px;padding-top:70px;")
// iframe.display-element(src='https://newtube.app/embed/ScMyHdB', frameborder='0', allowfullscreen='' style="width:80%;height:400px;")

h1.lead-header.fw Introducing #{brandName}
h2.tagline-header.fw An open-source YouTube alternative powered by Node.js
h1.lead-header.fw #{__('Introducing {{brandName}}', {brandName: brandName})}
h2.tagline-header.fw #{__('An open-source YouTube alternative powered by Node.js')}
hr

.row.first-row
.col-sm-4
h2.pitch-header.fw No Email Required &nbsp
h2.pitch-header.fw #{__('No Email Required ')}
i.fa.fa-bolt
p.explainer.fw Start your channel on #{brandName}
p.fw without having to verify your email
p.explainer.fw #{__('Start your channel on {{brandName}}', {brandName: brandName})}
p.fw #{__('without having to verify your email')}
.col-sm-4
h2.pitch-header.fw Video, Audio, Images &nbsp
h2.pitch-header.fw #{__('Video, Audio, Images ')}
i.fa.fa-thumbs-o-up
p.explainer.fw Over 30 file formats are supported
p.fw between video, audio and image uploads
p.explainer.fw #{__('Over 30 file formats are supported')}
p.fw #{__('between video, audio and image uploads')}
.col-sm-4
h2.pitch-header.fw 100% Open Source &nbsp
h2.pitch-header.fw #{__('100% Open Source ')}
i.fa.fa-space-shuttle
p.explainer.fw Create your own #{brandName} instance
p.fw in just minutes following our tutorials
p.explainer.fw #{__('Create your own {{brandName}} instance', {brandName: brandName})}
p.fw #{__('in just minutes following our tutorials')}


.row.second-row
.col-sm-4
h2.pitch-header.fw #{channelAmount} Channels &nbsp
h2.pitch-header.fw #{__('{{channelAmount}} Channels ', {channelAmount: channelAmount})}
i.fa.fa-users
p.explainer.fw The number of creators who have
p.fw chosen #{brandName} for their media hosting
p.explainer.fw #{__('The number of creators who have')}
p.fw #{__('chosen {{brandName}} for their media hosting', {brandName: brandName})}
.col-sm-4
h2.pitch-header.fw #{mediaAmount} Uploads &nbsp
h2.pitch-header.fw #{__('{{mediaAmount}} Uploads ', {mediaAmount: mediaAmount})}
i.fa.fa-upload
p.explainer.fw The number of times creators have
p.fw chosen #{brandName} for their content hosting
p.explainer.fw #{__('The number of times creators have')}
p.fw #{__('chosen {{brandName}} for their content hosting', {brandName: brandName})}
.col-sm-4
h2.pitch-header.fw #{viewAmount} Views &nbsp
h2.pitch-header.fw #{__('{{viewAmount}} Views ', {viewAmount: viewAmount})}
i.fa.fa-video
p.explainer.fw The number of times people have
p.fw enjoyed the innovative new platform
p.explainer.fw #{__('The number of times people have')}
p.fw #{__('enjoyed the innovative new platform')}