Skip to content
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

GSoC 2024: Internationalization Implementation for Zimit Frontend #51

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
502fc8b
Add Vue I18n related dependencies for internationalization support
Onyx2406 Mar 10, 2024
d3c9e01
Update Vue components to support i18n
Onyx2406 Mar 10, 2024
586958e
Update Vue components to support i18n
Onyx2406 Mar 10, 2024
ca66949
Update Vue components to support i18n
Onyx2406 Mar 10, 2024
6f5ebb9
Update Vue components to support i18n
Onyx2406 Mar 10, 2024
4c004dd
Update Vue components to support i18n
Onyx2406 Mar 10, 2024
2c9d206
Update Vue components to support i18n
Onyx2406 Mar 10, 2024
1cff42f
Configure Vue I18n in main.js for dynamic translation loading
Onyx2406 Mar 10, 2024
4e3c249
Add files via upload
Onyx2406 Mar 10, 2024
aa02f60
Update NavBar.vue to i18n
Onyx2406 Mar 11, 2024
96944fe
Remove strings that are not used
Onyx2406 Mar 11, 2024
6e3b351
Remove strings that are not used
Onyx2406 Mar 11, 2024
fb67726
Update App.vue to i18n footer
Onyx2406 Mar 11, 2024
ea5114e
Update en.json
Onyx2406 Mar 11, 2024
647e9d0
Update fr.json
Onyx2406 Mar 11, 2024
9f29f54
Add qqq.json for translation instructions
Onyx2406 Mar 11, 2024
f493a1b
Add persian
Onyx2406 Mar 11, 2024
7e65335
Update NavBar.vue to add Persian in dropdown
Onyx2406 Mar 11, 2024
632384a
Fix footer translation, dropdown text.
Onyx2406 Mar 12, 2024
0993ce6
Resolve merge conflicts
Onyx2406 Mar 12, 2024
8553463
Remove AlertFeedback, SwitchButton translation strings
Onyx2406 Mar 12, 2024
0624a5e
Remove pers.json
Onyx2406 Mar 12, 2024
ae4afb3
Fix Faq content not showing and internationalize human_size_limit and…
Onyx2406 Mar 12, 2024
c393a5e
Change far.json to fa.json
Onyx2406 Mar 12, 2024
632a388
Change far.json to fa.json
Onyx2406 Mar 12, 2024
96a34d5
Load fa.json
Onyx2406 Mar 12, 2024
a33d73d
Add dynamic RTL support for Farsi language
Onyx2406 Mar 14, 2024
b15e046
i18 NewRequest and Request Component
Onyx2406 Mar 15, 2024
b5e7c88
Update Request.vue
Onyx2406 Mar 15, 2024
bb738ba
Fix footer text
Onyx2406 Apr 6, 2024
ea66868
Fix footer text
Onyx2406 Apr 6, 2024
5689c00
Merge branch 'my-dev-branch' into dev
Onyx2406 Apr 6, 2024
5ef22f5
Fix links not showing in FAQ entries
Onyx2406 Apr 6, 2024
9983a7a
Update en.json
Onyx2406 Apr 6, 2024
6bbd6df
Remove et --hard e3a1b35
Onyx2406 Apr 6, 2024
c6fe8af
Fix repeating strings in FAQ Entries
Onyx2406 Apr 6, 2024
e750147
Handle Pluralization
Onyx2406 Apr 6, 2024
f20692f
Remove sizeLimit in locales
Onyx2406 Apr 6, 2024
f576578
Update faq.vue
Onyx2406 Apr 6, 2024
6343c26
Updated en.json, including qqq.json. Standardized HTML code placement…
Onyx2406 Apr 8, 2024
ac1bb17
RTL Support for buttons of the FAQ
Onyx2406 Apr 8, 2024
d62680a
Logo to center, simplifies RTL Support CSS in FaqEntry.vue
Onyx2406 Apr 9, 2024
44bc447
CSS Refactor in FaqEntry.vue
Onyx2406 Apr 9, 2024
adcb06c
Keep only logo at the center, not the dropdown button
Onyx2406 Apr 11, 2024
284c7db
Fix - logo size was altered, now it remains constant
Onyx2406 Apr 11, 2024
1e7a70b
Remove class names in </Loading> , </header>
Onyx2406 Apr 11, 2024
597c786
Updated NavBar.vue
Onyx2406 Apr 12, 2024
68d5fae
Update NewRequest.vue
Onyx2406 Apr 12, 2024
0fafa07
Fix incorrect component import
Onyx2406 Apr 12, 2024
beb4986
Update main.js
Onyx2406 Apr 13, 2024
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
9 changes: 1 addition & 8 deletions ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@
<NavBar />
<AlertFeedback />
<router-view />
<footer>
{{ $t('app.poweredBy') }}
<a target="_blank" :href="$t('app.kiwixLink')">{{ $t('app.kiwix') }}</a>
{{ $t('app.and') }}
<a target="_blank" :href="$t('app.webrecorderLink')">{{ $t('app.webrecorder') }}</a>,
<span v-html="$t('app.thanksToMozilla')"></span>
<b-icon icon="heart-fill" style="color: rgb(234, 74, 170);" />
</footer>
<footer v-html="$t('footer.str')"></footer>
</div>
</template>

Expand Down
14 changes: 3 additions & 11 deletions ui/src/components/Faq.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@
<div class="faq" role="tablist">
<FaqEntry id="what-is-zim" :title="$t('faq.whatIsZim')">
<template v-slot:default>
{{ $t('faq.whatIsZimDesc1') }}
<a target="_blank" href="https://en.wikipedia.org/wiki/Offline">{{ $t('faq.offline') }}</a>
{{ $t('faq.whatIsZimDesc2') }}
<div v-html="$t('faq.whatIsZimDesc')"></div>
</template>
</FaqEntry>

<FaqEntry id="how-to-read" :title="$t('faq.howToRead')">
<template v-slot:default>
{{ $t('faq.howToReadDesc1') }}
<a target="_blank" href="https://kiwix.org/">Kiwix</a>,
{{ $t('faq.howToReadDesc2') }}
<a target="_blank" href="https://www.kiwix.org/en/download/">{{ $t('faq.desktopMobileAndMore') }}</a>.
{{ $t('faq.howToReadDesc3') }}
<div v-html="$t('faq.howToReadDesc')"></div>
</template>
</FaqEntry>

Expand All @@ -29,9 +23,7 @@

<FaqEntry id="got-error" :title="$t('faq.gotError')">
<template v-slot:default>
{{ $t('faq.gotErrorDesc1') }}
<a target="_blank" href="https://github.com/openzim/zimit/issues">github</a>
{{ $t('faq.gotErrorDesc2') }}
<div v-html="$t('faq.gotErrorDesc')"></div>
</template>
</FaqEntry>
</div>
Expand Down
55 changes: 35 additions & 20 deletions ui/src/components/FaqEntry.vue
Original file line number Diff line number Diff line change
@@ -1,41 +1,54 @@
<template>
<b-card no-body class="mb-1">
<b-card-header header-tag="header" class="p-1" role="tab">
<b-button block v-b-toggle="[id]" variant="neutral">{{ title }}
<b-icon icon="plus" class="plus" font-scale="1.5"></b-icon>
<b-icon icon="dash" class="minus" font-scale="1.5"></b-icon></b-button>
</b-card-header>
<b-collapse :id="id" accordion="faq-accordion" role="tabpanel">
<b-card-body>
<b-card-text><slot></slot></b-card-text>
</b-card-body>
</b-collapse>
</b-card>
<b-card no-body class="mb-1">
<b-card-header header-tag="header" class="p-1" role="tab">
<b-button block v-b-toggle="[id]" variant="neutral">{{ title }}
<b-icon icon="plus" class="plus" font-scale="1.5"></b-icon>
<b-icon icon="dash" class="minus" font-scale="1.5"></b-icon></b-button>
</b-card-header>
<b-collapse :id="id" accordion="faq-accordion" role="tabpanel">
<b-card-body>
<b-card-text><slot></slot></b-card-text>
</b-card-body>
</b-collapse>
</b-card>
</template>

<script type="text/javascript">
export default {
name: 'FaqEntry',
props: {
id: String,
title: String,
},
}
export default {
name: 'FaqEntry',
props: {
id: String,
title: String,
},
}
</script>

<style type="text/css" scoped>
.card-header .btn {
text-align: left;
text-align: start;
}

.card-header .plus, .card-header .minus {
position: absolute;
top: .5em;
}

/* LTR specific styles */
Onyx2406 marked this conversation as resolved.
Show resolved Hide resolved
:root[dir="ltr"] .card-header .plus,
:root[dir="ltr"] .card-header .minus {
right: .3rem;
}

/* RTL specific styles */
:root[dir="rtl"] .card-header .plus,
:root[dir="rtl"] .card-header .minus {
left: .3rem;
}

.card-header .collapsed .minus {
display: none;
}

.card-header .not-collapsed .plus {
display: none;
}
Expand All @@ -47,9 +60,11 @@
margin-bottom: 0 !important;
border-radius: 0;
}

.faq .card:not(:first-child) {
border-top: 0;
}

.card-header {
background-color: transparent;
border: 0;
Expand Down
14 changes: 10 additions & 4 deletions ui/src/components/Request.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,17 @@ export default {
!(key === "time_limit" && val >= Constants.zimit_time_limit))
.reduce((obj, [key, val]) => ({ ...obj, [key]: val }), {});
},
human_size_limit() {
return this.$t('request.humanSizeLimit', { size: `${parseInt(Constants.zimit_size_limit / 1073741824)}` });
human_size_limit() {
const sizeInGiB = parseInt(Constants.zimit_size_limit / 1073741824);
return this.$t('request.humanSizeLimit', { size: sizeInGiB });
},
human_time_limit() {
return this.$t('request.humanTimeLimit', { hours: `${parseInt(Constants.zimit_time_limit / 3600)}` });
human_time_limit() {
const timeInHours = parseInt(Constants.zimit_time_limit / 3600);
const unitKey = `units.timeLimit.${timeInHours === 1 ? 'hour' : 'hours'}`;
return this.$t('request.humanTimeLimit', {
hours: timeInHours,
unit: this.$t(unitKey)
});
},
limit_hit() {
return this.task.container && this.task.container.progress && this.task.container.progress.limit && this.task.container.progress.limit.hit;
Expand Down
76 changes: 35 additions & 41 deletions ui/src/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,79 +1,73 @@
{
"faq":
{
"faq": {
"whatIsZim": "What is a Zim file?",
"whatIsZimDesc1": "The Zim file format stores website content for ",
"whatIsZimDesc2": " usage. It assembles the normal constituent of a website into a single archive, and compresses it so as to make it easier to save, share, and store.",
"whatIsZimDesc": "The Zim file format stores website content for <a target='_blank' href='https://en.wikipedia.org/wiki/Offline'>offline</a> usage. It assembles the normal constituent of a website into a single archive, and compresses it so as to make it easier to save, share, and store.",
"howToRead": "How do I read my Zim files?",
"howToReadDesc1": "You will need a Zim file reader. This usually means ",
"howToReadDesc2": ", which is available on ",
"howToReadDesc3": "Currently only Kiwix-serve and Kiwix-Android can read all Zimit-generated files. If using Kiwix-Desktop for Microsoft Windows and GNU/Linux, then you will need to configure it as a Kiwix-serve instance in the settings. We expect most platforms to be upgraded by the end of 2021.",
"howToReadDesc": "You will need a Zim file reader. This usually means <a target='_blank' href='https://kiwix.org'>Kiwix</a>, which is available on <a target='_blank' href='https://www.kiwix.org/en/download/'>desktop computers, mobile devices, and more</a>. Currently only Kiwix-serve and Kiwix-Android can read all Zimit-generated files. If using Kiwix-Desktop for Microsoft Windows and GNU/Linux, then you will need to configure it as a Kiwix-serve instance in the settings. We expect most platforms to be upgraded by the end of 2021.",
"missingContent": "The Zim file is incomplete or smaller than the original website",
"missingContentDesc": "Because of the very nature of this tool, we can’t leave it open for unlimited requests towards any website. That could be harmful both for our infrastructure, but also for the target websites. We currently enforce two limits: {human_size_limit} file size and {human_time_limit}.",
"gotError": "I got an error message (no zim) or could not read a zim file",
"gotErrorDesc1": "Triple-check the URL you entered, and if it is still not working then open a bug ticket on",
"gotErrorDesc2": ". Indicate the target website, the request number (it’s in the email you received), and the device you tried to open your zim file on.",
"desktopMobileAndMore": "desktop computers, mobile devices, and more",
"offline": "offline"
},
"errorMessages":
{
"gotErrorDesc": "Triple-check the URL you entered, and if it is still not working then open a bug ticket on <a target='_blank' href='https://github.com/openzim/zimit/issues'>github</a>. Indicate the target website, the request number (it’s in the email you received), and the device you tried to open your zim file on."
},
"errorMessages": {
"unableToRequestZIMCreation": "Unable to request ZIM creation:"
},
"units":
{
"timeLimit":
{
"units": {
"timeLimit":{
"singular": "hour",
"plural": "hours"
}
},
"app":
{
"poweredBy": "Powered by",
"kiwix": "Kiwix",
"kiwixLink": "https://kiwix.org",
"and": "and",
"webrecorder": "Webrecorder",
"webrecorderLink": "https://webrecorder.net",
"thanksToMozilla": "thanks to a <a target='_blank' href='https://www.mozilla.org/moss/'>Mozilla Open-Source Support Award </a>"
"footer": {
"str": "Powered by <a target='_blank' href='https://kiwix.org'>Kiwix</a> and <a target='_blank' href='https://webrecorder.net'>Webrecorder</a>, thanks to a <a target='_blank' href='https://www.mozilla.org/moss/'>Mozilla Open-Source Support</a> Award ❤️"
},
"loading":
{
"loading": {
"loading": "Loading…"
},
"navbar":
{
"navbar": {
"logoAlt": "Youzim.it logo"
Onyx2406 marked this conversation as resolved.
Show resolved Hide resolved
},
"newRequest":
{
"newRequest": {
"heading": "Want an offline version of a website? Just",
"boldZim": "Zim it",
"urlPlaceholder": "Full URL of the website to convert",
"emailPlaceholder": "Your e-mail to receive a download link. Address not kept",
"submit": "Let's Zim it!",
"advancedOptions": "advanced options"
"advancedOptions": "advanced options",
"notSet": "Not set",
"fetchingDefinition": "fetching definition…",
"standardHTTPError": "Unable to request ZIM creation:<br />%{error}",
"creatingSchedule": "Creating schedule…",
"noTaskIdReceived": "Didn't receive task_id",
"unableToRequestZIM": "Unable to request ZIM creation:<br />%{error}"
},
"notFound":
{
"notFound": {
"heading": "Not Found",
"description": "Sorry, this content was not found. Maybe you'd like to go back."
},
"request":
{
"requestingSlot": "Requesting slot",
"request": {
"zimingOf": "Ziming of ",
"requestingSlot": "Requesting slot",
"requestRecorded": "Your request has been recorded and is awaiting a slot on our infrastructure to run.",
"requestFailed": "Your request has failed! We are sorry about that.",
"failureReasons": "A number of reasons can lead to a ziming failure. Most of the time, it's an inadequate URL… Please triple check it and create a new request. If that doesn't work, open a ticket in github.",
"openTicket": "open a ticket in github",
"success": "Success!",
"linkExpires": "The link below will expire and the file will be deleted after a week.",
"download": "Download",
"limitHit": "You have reached the maximum file size or duration allowed for free crawling. Contact us to help us purchase additional server space for you.",
"beingProcessed": "Your request is being processed",
"serverConverting": "One of our servers is currently converting that URL into a nice ZIM file. Depending on the number of pages and resources available, it can be a matter of minutes, hours or even days! Please be patient.",
"emailNotification": "You can close this window. You will get an email notification when the task is completed."
"serverConverting": "One of our servers is currently converting that URL into a nice ZIM file. Depending on the number of pages and resources available, it can be a matter of minutes, hours, or even days! Please be patient.",
"emailNotification": "You can close this window. You will get an email notification when the task is completed.",
"pending": "pending",
"inProgress": "in progress",
"humanSizeLimit": "You have reached the maximum file size of {size} GiB.",
"humanTimeLimit": "You have reached the maximum duration of {hours} {unit}.",
"loadingTask": "Retrieving task…",
"noDataReceived": "Didn't receive task data.",
"taskNotFound": "No task found with this ID. It probably has expired.",
"taskRetrieveError": "Unable to retrieve task: {error}",
"title": "Settings"
}
}

30 changes: 10 additions & 20 deletions ui/src/locales/fa.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"faq":
{
"faq":{
"whatIsZim": "فایل زیم چیست؟",
"whatIsZimDesc1": "فرمت فایل زیم محتوای وب‌سایت را برای ",
"whatIsZimDesc2": "استفاده ذخیره می‌کند. این فرمت اجزای اصلی یک وب‌سایت را در یک آرشیو واحد جمع‌آوری و فشرده‌سازی می‌کند تا ذخیره‌سازی، به اشتراک‌گذاری، و نگهداری آن آسان‌تر شود.",
Expand All @@ -16,20 +15,16 @@
"desktopMobileAndMore": "رایانه‌های دسکتاپ، دستگاه‌های موبایل و بیشتر",
"offline": "آفلاین"
},
"errorMessages":
{
"errorMessages":{
"unableToRequestZIMCreation": "درخواست ایجاد ZIM ممکن نیست:"
},
"units":
{
"timeLimit":
{
"units":{
"timeLimit":{
"singular": "ساعت",
"plural": "ساعت"
}
},
"app":
{
"app":{
"poweredBy": "به قدرت از",
"kiwix": "کیویکس",
"kiwixLink": "https://kiwix.org",
Expand All @@ -38,30 +33,25 @@
"webrecorderLink": "https://webrecorder.net",
"thanksToMozilla": "با تشکر از <a target='_blank' href='https://www.mozilla.org/moss/'>جایزه پشتیبانی منبع‌باز موزیلا</a> "
},
"loading":
{
"loading":{
"loading": "در حال بارگذاری..."
},
"navbar":
{
"navbar":{
"logoAlt": "لوگوی Youzim.it"
},
"newRequest":
{
"newRequest":{
"heading": "می‌خواهید یک نسخه آفلاین از یک وب‌سایت داشته باشید؟ فقط",
"boldZim": "زیم کنید",
"urlPlaceholder": "آدرس URL کامل وب‌سایت برای تبدیل",
"emailPlaceholder": "آدرس ایمیل خود را برای دریافت لینک دانلود وارد کنید. آدرس نگه دارده نمی‌شود",
"submit": "بیایید آن را زیم کنیم!",
"advancedOptions": "گزینه‌های پیشرفته"
},
"notFound":
{
"notFound":{
"heading": "یافت نشد",
"description": "متاسفیم، این محتوا پیدا نشد. شاید دوست داشته باشید به عقب بروید."
},
"request":
{
"request":{
"requestingSlot": "درخواست اسلات",
"zimingOf": "تبدیل شدن به فایل زیم از ",
"requestRecorded": "درخواست شما ثبت شده است و منتظر یک اسلات در زیرساخت ما برای اجرا می‌باشد.",
Expand Down
Loading