Make course page translatable (#2811)

* feat: make it possible to translate the course page

* docs: document UI translation

* style: autoformat markdown files
This commit is contained in:
Daniel Kantor 2023-04-10 10:43:34 +02:00 committed by GitHub
parent d43ce86232
commit ae70daf702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 403 additions and 352 deletions

View File

@ -11,6 +11,7 @@ def _get_course_data(course: Course):
return {
"languageName": course.target_language.name,
"languageCode": course.target_language.code,
"uiLanguage": course.source_language.code,
"specialCharacters": course.special_characters,
"repositoryURL": course.repository_url,
"license": {

View File

@ -26,6 +26,7 @@ def test__get_course_data_return_value():
assert _get_course_data(fakes.course1) == {
"languageName": "my language",
"languageCode": "de",
"uiLanguage": "tr",
"specialCharacters": ["", "ß"],
# pylint: disable=line-too-long
"repositoryURL": "https://github.com/kantord/LibreLingo/tree/main/courses/spanish-from-english",
@ -79,6 +80,7 @@ def test__get_course_data_return_value_2():
assert _get_course_data(fakes.course2) == {
"languageName": "another language",
"languageCode": "tr",
"uiLanguage": "de",
"specialCharacters": ["ç", "ş"],
"repositoryURL": "https://github.com/LibreLingo/LibreLingo-ES-from-EN",
"license": {
@ -111,6 +113,7 @@ def test__get_course_data_return_value_with_introduction():
assert _get_course_data(course_with_markdown) == {
"languageName": "another language",
"languageCode": "tr",
"uiLanguage": "de",
"specialCharacters": ["ç", "ş"],
"repositoryURL": "https://github.com/LibreLingo/LibreLingo-ES-from-EN",
"license": {

View File

@ -43,9 +43,14 @@ Feature: Course page
And I don't read "pan, leche"
Scenario: Strengthening stale skill
Given I open "/course/test-1"
Given I open "/course/test-1"
And I have a stale skill
Then I see a stale skill
Given I complete a lesson
Then I don't see any stale skills
Scenario: Visiting a course page that is not in English
Given I open "/course/test-2"
And I have a stale skill
Then I see a "Practicar" button

View File

@ -148,6 +148,7 @@ exports[`get_course returns correct course data: test course data 1`] = `
"¿",
"¡",
],
"uiLanguage": "en",
}
`;

View File

@ -32,6 +32,7 @@ const formatCourseData = (rawCourseData, { courseName }) => {
repositoryURL,
languageCode,
specialCharacters,
uiLanguage,
} = rawCourseData
return {
@ -41,6 +42,7 @@ const formatCourseData = (rawCourseData, { courseName }) => {
repositoryURL,
languageCode,
specialCharacters,
uiLanguage,
}
}

View File

@ -1,6 +1,7 @@
{
"languageName": "Test Language",
"languageCode": "test",
"uiLanguage": "en",
"specialCharacters": [
"á",
"Á",

View File

@ -1,6 +1,7 @@
{
"languageName": "Test Language",
"languageCode": "test",
"uiLanguage": "es",
"specialCharacters": [
"á",
"Á",

View File

@ -1,6 +1,7 @@
import { register, init } from "svelte-i18n"
register("en", () => require("./translation/en.json"))
register("es", () => require("./translation/es.json"))
register("fr", () => require("./translation/fr.json"))
register("de", () => require("./translation/de.json"))
register("it", () => require("./translation/it.json"))

View File

@ -8,6 +8,7 @@
</script>
<script lang="ts">
import { locale } from "svelte-i18n"
import SkillCard from "../../../components/SkillCard/index.svelte"
import NavBar from "../../../components/NavBar.svelte"
import Column from "lluis/Column.svelte"
@ -20,6 +21,9 @@
export let modules: ModulesType = null
export let languageName = null
export let repositoryURL = null
export let uiLanguage = "es"
locale.set(uiLanguage)
</script>
<svelte:head>

View File

@ -121,7 +121,7 @@ Mini-dictionary:
- provecho: profit
English:
Spanish:
- the:
- la
- el

View File

@ -4,8 +4,8 @@ Course:
IETF BCP 47: test
For speakers of:
Name: English
IETF BCP 47: en
Name: Spanish
IETF BCP 47: es
License:
Name: Attribution-ShareAlike 4.0 International

View File

@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities

View File

@ -2,9 +2,9 @@
This project has 2 main components
* Frontend, implemented using Svelte and TypeScript
* A set of Python packages that provide tooling for course creation
* ~Course editor, implemented using Django~ We don't have a Django based course editor anymore
- Frontend, implemented using Svelte and TypeScript
- A set of Python packages that provide tooling for course creation
- ~Course editor, implemented using Django~ We don't have a Django based course editor anymore
The site is statically built and hosted on GitHub pages, therefore there's no real "backend" or API.
@ -17,5 +17,5 @@ Please check out our development documentation for instructions on
Here are some tips:
* [Good first issues](https://github.com/LibreLingo/LibreLingo/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
* [Isssues that require some extra attention](https://github.com/LibreLingo/LibreLingo/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)
- [Good first issues](https://github.com/LibreLingo/LibreLingo/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
- [Isssues that require some extra attention](https://github.com/LibreLingo/LibreLingo/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)

View File

@ -1,5 +1,4 @@
GNU Affero General Public License
=================================
# GNU Affero General Public License
_Version 3, 19 November 2007_
_Copyright © 2007 Free Software Foundation, Inc. &lt;<http://fsf.org/>&gt;_
@ -14,13 +13,13 @@ software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
@ -34,8 +33,8 @@ and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
@ -43,14 +42,14 @@ source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
@ -68,12 +67,12 @@ modification follow.
works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this
License. Each licensee is addressed as “you”. “Licensees” and
License. Each licensee is addressed as “you”. “Licensees” and
“recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a “modified version” of the
exact copy. The resulting work is called a “modified version” of the
earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based
@ -82,12 +81,12 @@ on the Program.
To “propagate” a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices”
@ -95,14 +94,14 @@ to the extent that it includes a convenient and prominently visible
feature that **(1)** displays an appropriate copyright notice, and **(2)**
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
### 1. Source Code
The “source code” for a work means the preferred form of the work
for making modifications to it. “Object code” means any non-source
for making modifications to it. “Object code” means any non-source
form of a work.
A “Standard Interface” means an interface that either is an official
@ -115,7 +114,7 @@ than the work as a whole, that **(a)** is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and **(b)** serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
implementation is available to the public in source code form. A
“Major Component”, in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
@ -124,10 +123,10 @@ produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
@ -145,25 +144,25 @@ same work.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law
@ -201,23 +200,23 @@ You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
* **a)** The work must carry prominent notices stating that you modified
it, and giving a relevant date.
* **b)** The work must carry prominent notices stating that it is
released under this License and any conditions added under section 7.
This requirement modifies the requirement in section 4 to
“keep intact all notices”.
* **c)** You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
* **d)** If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
- **a)** The work must carry prominent notices stating that you modified
it, and giving a relevant date.
- **b)** The work must carry prominent notices stating that it is
released under this License and any conditions added under section 7.
This requirement modifies the requirement in section 4 to
“keep intact all notices”.
- **c)** You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
- **d)** If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
@ -225,7 +224,7 @@ and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
“aggregate” if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
@ -236,42 +235,42 @@ of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
* **a)** Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
* **b)** Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either **(1)** a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or **(2)** access to copy the
Corresponding Source from a network server at no charge.
* **c)** Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
* **d)** Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
* **e)** Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
- **a)** Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
- **b)** Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either **(1)** a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or **(2)** access to copy the
Corresponding Source from a network server at no charge.
- **c)** Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
- **d)** Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
- **e)** Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
@ -280,12 +279,12 @@ included in conveying the object code work.
A “User Product” is either **(1)** a “consumer product”, which means any
tangible personal property which is normally used for personal, family,
or household purposes, or **(2)** anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, “normally used” refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
@ -293,7 +292,7 @@ the only significant mode of use of the product.
“Installation Information” for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
@ -304,7 +303,7 @@ part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
@ -312,7 +311,7 @@ been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
@ -329,15 +328,15 @@ unpacking, reading or copying.
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
@ -345,29 +344,29 @@ Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
* **a)** Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
* **b)** Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
* **c)** Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
* **d)** Limiting the use for publicity purposes of names of licensors or
authors of the material; or
* **e)** Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
* **f)** Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
- **a)** Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
- **b)** Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
- **c)** Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
- **d)** Limiting the use for publicity purposes of names of licensors or
authors of the material; or
- **e)** Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
- **f)** Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered “further
restrictions” within the meaning of section 10. If the Program as you
restrictions” within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
@ -385,7 +384,7 @@ the above requirements apply either way.
### 8. Termination
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
@ -406,31 +405,31 @@ your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
### 9. Acceptance Not Required for Having Copies
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
### 10. Automatic Licensing of Downstream Recipients
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
@ -439,7 +438,7 @@ Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
@ -449,7 +448,7 @@ sale, or importing the Program or any portion of it.
### 11. Patents
A “contributor” is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims
@ -457,7 +456,7 @@ owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
consequence of further modification of the contributor version. For
purposes of this definition, “control” includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
@ -470,7 +469,7 @@ propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To “grant” such a patent license to a
sue for patent infringement). To “grant” such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
@ -482,7 +481,7 @@ then you must either **(1)** cause the Corresponding Source to be so
available, or **(2)** arrange to deprive yourself of the benefit of the
patent license for this particular work, or **(3)** arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. “Knowingly relying” means you have
license to downstream recipients. “Knowingly relying” means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
@ -499,7 +498,7 @@ work and works based on it.
A patent license is “discriminatory” if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
@ -519,10 +518,10 @@ otherwise be available to you under applicable patent law.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
@ -535,7 +534,7 @@ interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
@ -543,7 +542,7 @@ following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
@ -551,16 +550,16 @@ but the work with which it is combined will remain governed by version
### 14. Revised Versions of this License
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License “or any later version” applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
@ -570,19 +569,19 @@ public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
### 15. Disclaimer of Warranty
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
### 16. Limitation of Liability
@ -614,7 +613,7 @@ If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the “copyright” line and a pointer to where the full notice is found.
@ -639,9 +638,9 @@ Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
get its source. For example, if your program is a web application, its
interface could display a “Source” link that leads users to an archive
of the code. There are many ways you could offer source, and different
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.

View File

@ -1,8 +1,9 @@
# Media attributions
## Correct answer sound
[https://freesound.org/people/ertfelda/sounds/243701/](https://freesound.org/people/ertfelda/sounds/243701/)
## Wrong answer sound
[https://freesound.org/people/Autistic%20Lucario/sounds/142608/](https://freesound.org/people/Autistic%20Lucario/sounds/142608/)

View File

@ -2,9 +2,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>
Congratulations on your custom logo!
</title>
<title>Congratulations on your custom logo!</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
@font-face {
@ -111,36 +109,24 @@
<body>
<article>
<p>
Congratulations on creating your brand!
</p>
<p>Congratulations on creating your brand!</p>
<p>
Depending on the package you purchased, there are different file formats
of your logo in this download:
</p>
<ul>
<li>Basic Package: PNG file<br /></li>
<li>
Premium and Enterprise Packages: PNG, SVG, EPS, PDF files
</li>
<li>Premium and Enterprise Packages: PNG, SVG, EPS, PDF files</li>
</ul>
<h2>
Using your files
</h2>
<p>
Heres a quick breakdown of where and how to use your files:
</p>
<h3>
Online
</h3>
<h2>Using your files</h2>
<p>Heres a quick breakdown of where and how to use your files:</p>
<h3>Online</h3>
<p>
If youre using your logo for any digital purpose — from PowerPoint
presentations to social media profiles — choose PNG files.
</p>
<h3>
Print
</h3>
<h3>Print</h3>
<p>
If youre sending your logo to be printed on business cards, brochures,
clothing, and more, provide the printer with a PDF or EPS. If the print
@ -148,34 +134,26 @@
(SVG or EPS).
</p>
<h3>
Sending to a Designer
</h3>
<h3>Sending to a Designer</h3>
<p>
If youre sending your logo to a designer to make changes, use SVG or
EPS files unless they request otherwise.
</p>
<h3>
Sharing
</h3>
<h3>Sharing</h3>
<p>
When sharing a logo file, send a PDF or PNG, as theyre easy-to-read
file formats.
</p>
<h3>
Resizing
</h3>
<h3>Resizing</h3>
<p>
Dont see all of the file sizes you need? Use
<a href="http://resizeimage.net/" target="_blank">this website</a> to
adjust the file sizes of your PNG logo.
</p>
<h2>
Your Logo Font and Colors
</h2>
<h2>Your Logo Font and Colors</h2>
<section class="fonts_colors">
<div>
<h3>Fonts</h3>
@ -188,37 +166,29 @@
<h3>Colors</h3>
<div class="colors_list">
<div class="color">
<span class="swatch" style="background-color: FFAE42;"></span>
<span class="swatch" style="background-color: FFAE42"></span>
<span class="name">Yellow Orange 1</span>
<span class="hex">#FFAE42</span>
</div>
<div class="color">
<span class="swatch" style="background-color: D4E2FC;"></span>
<span class="swatch" style="background-color: D4E2FC"></span>
<span class="name">Hawkes Blue 4</span>
<span class="hex">#D4E2FC</span>
</div>
</div>
</div>
</section>
<h2>
Add-ons
</h2>
<h2>Add-ons</h2>
<p>
Want more help with your branding? Get business card designs, a social
media kit, or have your logo tweaked by one of our pro designers. Heres
how to purchase add-ons:
</p>
<ul>
<li>
Log in to your account and click your purchased logo
</li>
<li>
In the top right-hand corner, click Purchase Add-ons
</li>
<li>
Select the add-ons youd like, then click Continue to check out
</li>
<li>Log in to your account and click your purchased logo</li>
<li>In the top right-hand corner, click Purchase Add-ons</li>
<li>Select the add-ons youd like, then click Continue to check out</li>
<li>
Complete your purchase (youll only pay for the add-ons, not your
logo!)
@ -237,9 +207,7 @@
If you have any questions about your logo,
<a href="mailto:support@logojoy.com">Email Support</a>
</p>
<p>
Happy business-building!
</p>
<p>Happy business-building!</p>
</article>
</body>
</html>

View File

@ -2,9 +2,7 @@
<html>
<head>
<meta charset="utf-8" />
<title>
Congratulations on your custom logo!
</title>
<title>Congratulations on your custom logo!</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
@font-face {
@ -111,36 +109,24 @@
<body>
<article>
<p>
Congratulations on creating your brand!
</p>
<p>Congratulations on creating your brand!</p>
<p>
Depending on the package you purchased, there are different file formats
of your logo in this download:
</p>
<ul>
<li>Basic Package: PNG file<br /></li>
<li>
Premium and Enterprise Packages: PNG, SVG, EPS, PDF files
</li>
<li>Premium and Enterprise Packages: PNG, SVG, EPS, PDF files</li>
</ul>
<h2>
Using your files
</h2>
<p>
Heres a quick breakdown of where and how to use your files:
</p>
<h3>
Online
</h3>
<h2>Using your files</h2>
<p>Heres a quick breakdown of where and how to use your files:</p>
<h3>Online</h3>
<p>
If youre using your logo for any digital purpose — from PowerPoint
presentations to social media profiles — choose PNG files.
</p>
<h3>
Print
</h3>
<h3>Print</h3>
<p>
If youre sending your logo to be printed on business cards, brochures,
clothing, and more, provide the printer with a PDF or EPS. If the print
@ -148,34 +134,26 @@
(SVG or EPS).
</p>
<h3>
Sending to a Designer
</h3>
<h3>Sending to a Designer</h3>
<p>
If youre sending your logo to a designer to make changes, use SVG or
EPS files unless they request otherwise.
</p>
<h3>
Sharing
</h3>
<h3>Sharing</h3>
<p>
When sharing a logo file, send a PDF or PNG, as theyre easy-to-read
file formats.
</p>
<h3>
Resizing
</h3>
<h3>Resizing</h3>
<p>
Dont see all of the file sizes you need? Use
<a href="http://resizeimage.net/" target="_blank">this website</a> to
adjust the file sizes of your PNG logo.
</p>
<h2>
Your Logo Font and Colors
</h2>
<h2>Your Logo Font and Colors</h2>
<section class="fonts_colors">
<div>
<h3>Fonts</h3>
@ -188,37 +166,29 @@
<h3>Colors</h3>
<div class="colors_list">
<div class="color">
<span class="swatch" style="background-color: FFAE42;"></span>
<span class="swatch" style="background-color: FFAE42"></span>
<span class="name">Yellow Orange 1</span>
<span class="hex">#FFAE42</span>
</div>
<div class="color">
<span class="swatch" style="background-color: D4E2FC;"></span>
<span class="swatch" style="background-color: D4E2FC"></span>
<span class="name">Hawkes Blue 4</span>
<span class="hex">#D4E2FC</span>
</div>
</div>
</div>
</section>
<h2>
Add-ons
</h2>
<h2>Add-ons</h2>
<p>
Want more help with your branding? Get business card designs, a social
media kit, or have your logo tweaked by one of our pro designers. Heres
how to purchase add-ons:
</p>
<ul>
<li>
Log in to your account and click your purchased logo
</li>
<li>
In the top right-hand corner, click Purchase Add-ons
</li>
<li>
Select the add-ons youd like, then click Continue to check out
</li>
<li>Log in to your account and click your purchased logo</li>
<li>In the top right-hand corner, click Purchase Add-ons</li>
<li>Select the add-ons youd like, then click Continue to check out</li>
<li>
Complete your purchase (youll only pay for the add-ons, not your
logo!)
@ -237,9 +207,7 @@
If you have any questions about your logo,
<a href="mailto:support@logojoy.com">Email Support</a>
</p>
<p>
Happy business-building!
</p>
<p>Happy business-building!</p>
</article>
</body>
</html>

View File

@ -3,6 +3,7 @@
This document describes how LibreLingo's course system works and how to contribute to course content.
Understanding this document is the first step if you want to:
- edit or improve an existing course
- contribute a new accepted answer
- create a new course from scratch
@ -17,6 +18,7 @@ This is also a good resource if you just want to learn about the course system i
---
**Table of Contents:**
- [Getting started](#getting-started)
- [Basics](#basics)
- [Terminology](#terminology)
@ -32,7 +34,6 @@ This is also a good resource if you just want to learn about the course system i
- Want to edit or improve existing courses? Check out [this page about editing courses](editing-courses.md).
- If you want to create new courses (typically suited for course designers or advanced users), go to [this page](creating-courses.md).
## Basics
### Terminology
@ -48,8 +49,8 @@ These concepts represent a hierarchical structure to LibreLingo course material:
- The **target language** is the language the course is meant to teach.
- The **source language** is a language that users of the course are assumed to know.
<a id="exploring-courses"></a>
### Exploring the courses
To better understand how courses work, you can explore how the course files are organized on this repository.
@ -62,11 +63,12 @@ Go to [LibreLingo web app](https://librelingo.app/). Courses are listed there, e
When you enter a course page, for example, the [Spanish course](https://librelingo.app/course/spanish-from-english/), you'll see headings like Basics, Introduction, and Activities. These are modules. Each module contains a set of skills. Modules organize skills into groups, which is their only purpose. Think of them as groups of units or chapters.
"Skills" are units of course content focused on a particular topic. Each skill is a set of new knowledge, such as new words or phrases. Skills can focus on vocabulary and follow a theme: the "Animal" skill has words and phrases related to animals, and the "Food" skill is all about food. Skills can also focus on teaching grammar.
"Skills" are units of course content focused on a particular topic. Each skill is a set of new knowledge, such as new words or phrases. Skills can focus on vocabulary and follow a theme: the "Animal" skill has words and phrases related to animals, and the "Food" skill is all about food. Skills can also focus on teaching grammar.
Inside a skill YAML file there are some keys that you might want to learn of, which is explained in detail [here](skill.md).
<a id="things-new-contributors"></a>
### Things you can do as a new contributor
If you are new to contributing to course data, these are the things you can do to get a proper understanding of the courses and have a good time with the project:
@ -81,8 +83,8 @@ If you are new to contributing to course data, these are the things you can do t
- IETF BCP 47 tag name for your language, which you can get from [here](http://www.iana.org/assignments/language-subtag-registry). Just look for the `Subtag` for your language, e.g., fr, grc
- If you have questions, feel free to ask on [Discussions](https://github.com/kantord/LibreLingo/discussions).
<a id="courses-open"></a>
## Courses currently open for contributions
[Check out our devtool page for the up-to-date list](https://librelingo.app/dev/).
@ -90,6 +92,7 @@ If you are new to contributing to course data, these are the things you can do t
## Caution
<a id="non-latin-alphabet"></a>
### Languages that don't use the Latin alphabet
Currently, LibreLingo doesn't have enough features to support teaching new

View File

@ -12,6 +12,7 @@ Challenges are not configured directly but [automatically generated from Skill c
---
**Table of Contents:**
- [Challenge order](#challenge-order)
- [Cards challenge](#cards-challenge)
- [Short input challenge](#short-input-challenge)
@ -21,18 +22,18 @@ Challenges are not configured directly but [automatically generated from Skill c
## Challenge order
The order of words and phrases within a skill is random, but certain challenge types always come before others. This is denoted by the *Priority* values listed under each challenge type. First-priority challenges come before second-priority challenges, which come before third-priority challenges.
The order of words and phrases within a skill is random, but certain challenge types always come before others. This is denoted by the _Priority_ values listed under each challenge type. First-priority challenges come before second-priority challenges, which come before third-priority challenges.
## Cards challenge
![Text asks the user: which of these is "river"? Below this heading are three cards. Each card contains a Spanish word and a corresponding image. In the center, the correct choice (río) is selected.](/docs/screenshots/cards-challenge.png)
- *Generated from:* `New words` only
- *Task:* translation, multiple-choice
- *Direction:* source -> target only
- *Properties used:* `Word`, `Translation`, `Images` -- both of the asked word and of two or three other words in the same skill
- *Mini-dictionary available:* No
- *Priority*: First
- _Generated from:_ `New words` only
- _Task:_ translation, multiple-choice
- _Direction:_ source -> target only
- _Properties used:_ `Word`, `Translation`, `Images` -- both of the asked word and of two or three other words in the same skill
- _Mini-dictionary available:_ No
- _Priority_: First
In this challenge type, the user is presented with a word in their source language and three (four on mobile) cards to choose from. Each card contains a target language word and a matching image, which is a big hint since the user may have never seen this target language word before.
@ -42,25 +43,25 @@ Note that for each card, a random image is selected from the word's `Images` arr
![Text asks the user to type the word "river" in Spanish. Below this heading is a text box and a set of buttons to insert Spanish-specific characters. At right is an image of a river.](/docs/screenshots/short-input-challenge.png)
- *Generated from:* `New words` only
- *Task:* translation, free-form
- *Direction:* source -> target only
- *Properties used:* `Word`, `Translation`, `Images`
- *Mini-dictionary available:* Yes
- *Priority*: Second
- _Generated from:_ `New words` only
- _Task:_ translation, free-form
- _Direction:_ source -> target only
- _Properties used:_ `Word`, `Translation`, `Images`
- _Mini-dictionary available:_ Yes
- _Priority_: Second
In this challenge type, the user is presented with a word in their source language and a text box in which to input the translation into the target language. There is also a random image from the `Images` array on the right, but since this challenge asks for the target language, the image does not give the user any additional information. If the user does need a hint, the mini-dictionary is available for this challenge.
## Options challenge
![Text asks the user which one of the options is \"Let's go to the beach!\". Below this question are three Spanish sentences with radio buttons to their left.](/docs/screenshots/options-challenge.png)
![Text asks the user which one of the options is "Let's go to the beach!". Below this question are three Spanish sentences with radio buttons to their left.](/docs/screenshots/options-challenge.png)
- *Generated from:* `Phrases` only
- *Task:* translation, multiple-choice
- *Direction:* source -> target only
- *Properties used:* `Phrase`, `Translation` both of the asked phrase and two other phrases in the same skill
- *Mini-dictionary available:* No
- *Priority*: First
- _Generated from:_ `Phrases` only
- _Task:_ translation, multiple-choice
- _Direction:_ source -> target only
- _Properties used:_ `Phrase`, `Translation` both of the asked phrase and two other phrases in the same skill
- _Mini-dictionary available:_ No
- _Priority_: First
In this challenge type, the user is presented with a phrase in their source language and three options from which they must choose the correct translation into the target language. There are no hints available.
@ -68,16 +69,16 @@ In this challenge type, the user is presented with a phrase in their source lang
![Text instructs the user to translate the phrase "Let's go to the beach!". At the bottom of the image, there is a group of draggable Spanish words.](/docs/screenshots/chips-challenge.png)
- *Generated from:* `Phrases` only
- *Task:* translation, set of words provided
- *Direction:* Both directions: source -> target, target -> source
- *Properties used:*
- _Generated from:_ `Phrases` only
- _Task:_ translation, set of words provided
- _Direction:_ Both directions: source -> target, target -> source
- _Properties used:_
- If source -> target: `Phrase`, `Translation`, `Alternative translations`; `Translation` and `Alternative translations` of other phrases anywhere in the course
- If target -> source: `Translation`, `Phrase`, `Alternative versions`; `Phrase` and `Alternative versions` of other phrases anywhere in the course
- *Mini-dictionary available:* Yes
- *Priority*: Third
- _Mini-dictionary available:_ Yes
- _Priority_: Third
In this challenge type, the user is presented with a phrase in one language and a set of words in the other language. This set will always include all words of the `Translation` field. The user's task is to use these words as "building blocks" to create *any* acceptable translation for the phrase they've been presented with.
In this challenge type, the user is presented with a phrase in one language and a set of words in the other language. This set will always include all words of the `Translation` field. The user's task is to use these words as "building blocks" to create _any_ acceptable translation for the phrase they've been presented with.
The mini-dictionary is available to give hints about individual words, but there are no hints about grammar or sentence structure.
@ -87,11 +88,11 @@ The chips will never include exact duplicates of each other.
![Text instructs the user: "Type what you hear". Below this heading is a text box and a set of buttons to insert Spanish-specific characters.](/docs/screenshots/listening-challenge.png)
- *Generated from:* `New words` and `Phrases`
- *Task:* transcription
- *Direction:* N/A, target language only
- *Properties used:* `Word` or `Phrase`
- *Mini-dictionary available:* No
- *Priority*: Second
- _Generated from:_ `New words` and `Phrases`
- _Task:_ transcription
- _Direction:_ N/A, target language only
- _Properties used:_ `Word` or `Phrase`
- _Mini-dictionary available:_ No
- _Priority_: Second
In this challenge type, the user is played audio of a word or phrase in the target language and is presented with a text box to transcribe the audio (still in the target language). The user can re-listen to the audio if necessary.

View File

@ -12,6 +12,7 @@ To get a better understanding, you can explore the [`courses` directory](https:/
---
**Table of Contents:**
- [Tree structure](#tree-structure)
- [`course.yaml`](#yaml)
- [Data breakdown](#data-breakdown)
@ -52,6 +53,7 @@ Here, `activities`, `basics`, and `introduction` are [modules](module.md). The `
A course directory name should not have spaces and should be written in `slug-form` in plain English.
<a id="yaml"></a>
## `course.yaml`
A `course.yaml` file for the Spanish course looks like this:
@ -95,9 +97,11 @@ Modules:
```
<a id="data-breakdown"></a>
### Data breakdown
**`Course`** has information about the course.
- `Language`
- `Language > Name`: The name of the language you want to test for or teach.
- `Language > IETF BCP 47`: The IETF BCP 47 code of the above language. List available [here](http://www.iana.org/assignments/language-subtag-registry).
@ -113,6 +117,7 @@ Modules:
**`Modules`** has a list of module directory names followed by a `/`.
<a id="spell-checker"></a>
#### Automated spell checker
To avoid mistakes, you can enable automatic spell-checking in your course. Automatic spell-checking won't let you export
@ -128,7 +133,7 @@ sudo apt-get update -y
sudo apt-get install -y hunspell
```
Don't forget to also install a dictionary for the languages that you use in your course. Here's a list of
Don't forget to also install a dictionary for the languages that you use in your course. Here's a list of
dictionary packages available on Ubuntu: https://packages.ubuntu.com/bionic/hunspell-dictionary
In order to enable Hunspell in your course, add the following section to your `course.yaml`:
@ -136,8 +141,8 @@ In order to enable Hunspell in your course, add the following section to your `c
```yaml
Settings:
Hunspell:
German: de # replace with the language code for your language
English: en-US # replace with the language code for your language
German: de # replace with the language code for your language
English: en-US # replace with the language code for your language
```
Keep in mind that you also need to have the `hunspell` Python package installed. To install it, just run:
@ -145,4 +150,3 @@ Keep in mind that you also need to have the `hunspell` Python package installed.
```bash
pip install hunspell
```

View File

@ -12,6 +12,7 @@ To get a better understanding, we recommend you read the [course basics](README.
---
**Table of Contents:**
- [Setup](#setup)
- [Pulling code and branching](#pulling-and-branching)
- [Pushing code and creating Pull Request](#pushing-and-pr)
@ -23,9 +24,11 @@ To get a better understanding, we recommend you read the [course basics](README.
## Setup
<a id="pulling-and-branching"></a>
### Pulling code and branching
LibreLingo uses a Git repository for maintaining code. In order to contribute changes, you first need to fork this project. To fork:
- [login](https://github.com/login) to GitHub
- then go to [LibreLingo repository](https://github.com/LibreLingo/LibreLingo/)
- click the "Fork" button (beside Watch and Star)
@ -71,6 +74,7 @@ You can name it as your language name if you want, but without spaces (e.g. `kor
You are now ready to make changes.
<a id="pushing-and-pr"></a>
### Pushing code and creating Pull Request
These instructions are written to be used after making the changes. So you can read the rest of the page and continue from here if you want.
@ -112,19 +116,23 @@ A pull request is a request to apply your changes to the original project. Such
After you post the pull request, project maintainers will look into your changes and respond. When they do, you'll get a [notification](https://github.com/notifications) on GitHub.
<a id="following-up-pr"></a>
### Following up with PR responses
Depending on the Pull Request (PR) you made earlier, you can either get accepted right away (in that case, it will be "merged"), or you may need to make some changes (you'll get comments). If the project maintainers ask for a change, do this:
- `cd` into the git repository directory, or open a terminal on the directory
- Make sure you're on the branch in which you made changes earlier. Check with `git status`, and if not on the proper branch, switch to it with:
```sh
git checkout my-awesome-branch
```
- **NOTE:** If you don't remember which branch you were in, check the Pull request you made or run `git branch -a` to find out and switch to it.
- Make the changes requested.
- Check that the changes are what you were asked to do by running `git diff` (Page up/down to scroll, q to quit).
- When ready:
```sh
git add courses/
git commit --amend --no-edit
@ -143,9 +151,10 @@ Right now, the only TTS provider supported by LibreLingo is Amazon Polly. You'll
./scripts/updateAudioForYamlCourse.sh <name of edited course, e.g. spanish-from-english>
```
If you'd like to simply *see* the audio changes that need to be made without actually performing them, add the `--dry-run` flag. In rare circumstances, you may want to completely regenerate the audio for a course, overwriting everything that's already there. This can be done with the `--destructive` flag -- but use it with care!
If you'd like to simply _see_ the audio changes that need to be made without actually performing them, add the `--dry-run` flag. In rare circumstances, you may want to completely regenerate the audio for a course, overwriting everything that's already there. This can be done with the `--destructive` flag -- but use it with care!
<a id="translating"></a>
## Translating based on an existing course
If you just want to translate an existing course, the simplest way is to copy the existing course. Right now, `spanish-from-english` is the most complete. So:
@ -161,6 +170,7 @@ _**NOTE:** When editing existing skill yaml files, do not change the skill IDs s
When you are done, you can continue to the [pull request section](#pushing-and-pr) to submit the changes.
<a id="editing-existing"></a>
## Editing existing courses
If you want to make edits to course data, consult [Course](course.md), [Module](module.md) or [Skill](skill.md) documentation for details or [discuss](https://github.com/LibreLingo/LibreLingo/discussions) if you're unsure on how to do something.

View File

@ -14,6 +14,7 @@ To get a better understanding, you can read the [course basics](README.md#basics
---
**Table of Contents:**
- [Tree structure](#tree-structure)
- [`module.yaml`](#yaml)
- [Data breakdown](#data-breakdown)
@ -44,6 +45,7 @@ NOTE: A module directory name should not have spaces, be written in slug-form, a
NOTE: When a new module is created, it should be listed on the [`course.yaml`](course.md#yaml) under [`Modules` key](course.md#data-breakdown).
<a id="yaml"></a>
## `module.yaml`
A `module.yaml` file for the Spanish Basics module looks like this:
@ -69,6 +71,7 @@ Skills:
**`Skills`** has a list of yaml files for the skills under the module. NOTE: The order in which the skills appear in this YAML file is the order they will appear in the web app as well.
<a id="creating-new"></a>
## Creating a new module
To create a new module,
@ -76,7 +79,6 @@ To create a new module,
- Create a directory under the course with the module name (keep it lowercase and no spaces)
- Create a `module.yaml` file and put yaml code for the module.
For example, `courses/french-from-english/traveling/module.yaml` from the example above:
```yaml

View File

@ -14,6 +14,7 @@ The words and phrases that make up a skill are taught to the user using [automat
---
**Table of Contents:**
- [Tree structure](#tree-structure)
- [`(skill_name).yaml`](#yaml)
- [Data breakdown](#data-breakdown)
@ -44,6 +45,7 @@ Here, `animals.yaml`, `clothes.yaml`, and `food.yaml` are skills. These skill fi
Skill yaml filenames should not have spaces and should be written in `slug-form`. The human-friendly `Name` in the yaml, however, can contain uppercase and spaces.
<a id="yaml"></a>
## `(skill_name).yaml`
As an example, let's look into the `courses/french-from-english/basics/skills/hello.yaml` file, which looks like this:
@ -111,22 +113,25 @@ Two-way-dictionary:
### Data breakdown
**`Skill`** has information about the skill.
- `Skill > Name`: The human-friendly name of the skill.
- `Skill > Id`: The ID of the course. **NOTE:** This should be unchanged if you're translating or editing an existing course. Only if you're creating a new course should this have a unique [UUID v4](https://www.uuidgenerator.net/version4) string. Details for which you can find [here](creating-courses.md).
- `Skill > Thumbnails`: A list of filenames of the thumbnails to be used on the course page to give an idea of the skill. A list of available files can be found on [`apps/web/static/images/`](https://github.com/LibreLingo/LibreLingo/tree/main/apps/web/static/images). The names should be used without extension and without `_tiny` or `_tinier` parts, e.g., `banana2_tinier.jpg` should be written as `banana2`.
**`New words`** has a list of new words that the lesson teaches.
- `Word`: The word in the target language, i.e., the language the user is learning.
- `Synonyms`: A list of synonyms of the above word. (optional)
- `Translation`: Translation of the word in the source language, i.e., the language the user already knows.
- `Also accepted`: A list of alternative translations to the source language, which will *not* be taught but will be accepted as correct translations of the `Word` field if supplied by the user. Currently has no effect, but may be used by future challenge types. (optional)
- `Also accepted`: A list of alternative translations to the source language, which will _not_ be taught but will be accepted as correct translations of the `Word` field if supplied by the user. Currently has no effect, but may be used by future challenge types. (optional)
- `Images`: A list of images for the word that is defined under `Word` or `Translation` above. The image names have to be without extension and without `_tiny` or `_tinier` parts.
**`Phrases`** has a list of sentences or phrases that the lesson teaches.
- `Phrase`: The phrase in the target language.
- `Alternative versions`: A list of alternative versions of the phrase in the target language. These will *not* be taught but will be accepted as correct translations of the `Translation` field if supplied by the user. (optional)
- `Alternative versions`: A list of alternative versions of the phrase in the target language. These will _not_ be taught but will be accepted as correct translations of the `Translation` field if supplied by the user. (optional)
- `Translation`: Translation of the phrase to the source language.
- `Alternative translations`: A list of alternative translations to the source language, which will *not* be taught but will be accepted as correct translations of the `Phrase` field if supplied by the user. (optional)
- `Alternative translations`: A list of alternative translations to the source language, which will _not_ be taught but will be accepted as correct translations of the `Phrase` field if supplied by the user. (optional)
**`Mini-dictionary`** has a list of terms and meanings the user can view as a sort of "hint" if they are stuck. Entries are accessed by mousing over terms in an exercise, which brings up a tooltip with the corresponding term(s) in the other language. An entry is required for every term used in a skill.
@ -163,7 +168,6 @@ Mini-dictionary:
The Two-way-dictionary also disregards any parentheses on the original side but includes them on the translation side:
```
Two-way-dictionary:
- (I) eat: (yo) como
@ -179,22 +183,24 @@ Mini-dictionary:
- como: (I) eat
```
## How skills are taught to the user
As the course author, you have to specify the words and phrases you want to teach. LibreLingo will know how to present skills as a series of individual questions and tasks -- LibreLingo calls these "challenges." It is useful to understand what challenges will be generated.
For each vocabulary word (that is, each `New words` entry) in a skill, LibreLingo generates:
- A [cards challenge](challenge.md#cards-challenge) -- multiple-choice translation from the source language to the target language, with a visual clue
- A [short input challenge](challenge.md#short-input-challenge) -- free-form translation from the source language to the target language
- A [listening challenge](challenge.md#listening-challenge) -- transcription from target language audio to the target language text
For each phrase in a skill, LibreLingo generates:
- An [options challenge](challenge.md#options-challenge) -- multiple-choice translation from target language to source language
- Two [chips challenges](challenge.md#chips-challenge) -- translation using provided words, one in each translation direction, unless the phrase is one word
- A [listening challenge](challenge.md#listening-challenge) -- transcription from target language audio to the target language text
<a id="creating-new"></a>
## Creating new skills
Creating new skills is a matter of creating their corresponding YAML file.
@ -207,6 +213,7 @@ That being said, there are a couple of things to keep in mind:
a [`module.yaml`](module.md#yaml).
<a id="example-edit"></a>
## Examples of editing a skill
This is how you'd add a new alternative version to the
@ -245,17 +252,18 @@ Mini-dictionary:
French:
- dit: says
- bonjour:
- hello
- hi
...
English:
- says: dit
- hello:
- hello
- hi
---
English:
- says: dit
- hello:
- bonjour
- salut
```
<a id="tips"></a>
## Tips for creating good skills
- When it comes to teaching grammar, your main tool is to teach by example.
@ -263,6 +271,7 @@ Mini-dictionary:
- Do not try to teach verbs, adjectives, etc., using words. Instead, use them in phrases.
<a id="markdown"></a>
## `(skill_name).md`
In order to create an introduction page for your skill, you need to create a [Markdown](https://en.wikipedia.org/wiki/Markdown)

View File

@ -69,7 +69,7 @@ The output is:
==================================== test session starts =====================================
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
collected 0 items
collected 0 items
=================================== no tests ran in 0.00s ====================================
```
@ -98,7 +98,7 @@ We get this error:
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo
plugins: pyfakefs-4.4.0, mock-3.5.1, snapshottest-0.6.0
collected 178 items / 1 error / 177 selected
collected 178 items / 1 error / 177 selected
=========================================== ERRORS ===========================================
_________ ERROR collecting apps/librelingo_audios/tests/test_list_missing_audios.py __________
@ -157,7 +157,7 @@ You'll get the following output:
==================================== test session starts =====================================
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
collected 1 item
collected 1 item
tests/test_list_missing_audios.py . [100%]
@ -206,7 +206,7 @@ the second Skill of the first Module like so:
```python
In [6]: course.modules[0].skills[1].phrases
Out[6]:
Out[6]:
[Phrase(in_target_language=['Buen provecho'], in_source_language=['Enjoy your meal']),
Phrase(in_target_language=['Por favor'], in_source_language=['Please']),
Phrase(in_target_language=['Pan, por favor'], in_source_language=['Bread, please']),
@ -234,7 +234,7 @@ writing tests! Let's install it:
poetry add --dev librelingo-fakes
```
Let's *remove* our existing test:
Let's _remove_ our existing test:
```python
@ -262,7 +262,7 @@ If we run our tests again, we see the following failure:
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, snapshottest-0.6.0
collected 1 item
collected 1 item
tests/test_list_missing_audios.py F [100%]
@ -300,7 +300,7 @@ In [41]: count = 0
In [42]: for module in fakes.course1.modules:
...: for skill in module.skills:
...: count += len(skill.phrases)
...:
...:
In [43]: count
Out[43]: 2
@ -329,14 +329,13 @@ def list_missing_audios(course):
By further exploration, we learn that the second fake course doesn't have
any phrases:
```python
In [41]: count = 0
In [42]: for module in fakes.course2.modules:
...: for skill in module.skills:
...: count += len(skill.phrases)
...:
...:
In [43]: count
Out[43]: 0
@ -356,7 +355,7 @@ Our tests are failing again:
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, snapshottest-0.6.0
collected 2 items
collected 2 items
tests/test_list_missing_audios.py F. [100%]
@ -414,7 +413,7 @@ Let's run our tests again:
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, snapshottest-0.6.0
collected 3 items
collected 3 items
tests/test_list_missing_audios.py ..F [100%]
@ -449,7 +448,7 @@ Now we get this error:
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, snapshottest-0.6.0
collected 3 items
collected 3 items
tests/test_list_missing_audios.py ..F [100%]
@ -496,7 +495,7 @@ We get the following failure:
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, snapshottest-0.6.0
collected 4 items
collected 4 items
tests/test_list_missing_audios.py ...F [100%]
@ -563,7 +562,7 @@ def test_audio_id_is_a_string():
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, snapshottest-0.6.0
collected 5 items
collected 5 items
tests/test_list_missing_audios.py ....F [100%]
@ -625,13 +624,12 @@ def test_calls_audio_id_to_get_the_id(mocker):
This will mock the `audio_id` function and see how many times it has been called.
We assert that it has to run twice since there are 2 phrases that need audio files.
```console
==================================== test session starts =====================================
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, mock-3.5.1, snapshottest-0.6.0
collected 6 items
collected 6 items
tests/test_list_missing_audios.py .....F [100%]
@ -643,8 +641,8 @@ mocker = <pytest_mock.plugin.MockerFixture object at 0x7ff94ee398e0>
def test_calls_audio_id_to_get_the_id(mocker):
> audio_id = mocker.patch('librelingo_audios.list_missing_audios.audio_id')
tests/test_list_missing_audios.py:29:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_list_missing_audios.py:29:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/kdani/.cache/pypoetry/virtualenvs/librelingo-audios-yD2wurwN-py3.9/lib/python3.9/site-packages/pytest_mock/plugin.py:352: in __call__
return self._start_patch(
/home/kdani/.cache/pypoetry/virtualenvs/librelingo-audios-yD2wurwN-py3.9/lib/python3.9/site-packages/pytest_mock/plugin.py:161: in _start_patch
@ -653,27 +651,27 @@ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
result = self.__enter__()
/usr/lib/python3.9/unittest/mock.py:1405: in __enter__
original, local = self.get_original()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <unittest.mock._patch object at 0x7ff94ee39a00>
def get_original(self):
target = self.getter()
name = self.attribute
original = DEFAULT
local = False
try:
original = target.__dict__[name]
except (AttributeError, KeyError):
original = getattr(target, name, DEFAULT)
else:
local = True
if name in _builtins and isinstance(target, ModuleType):
self.create = True
if not self.create and original is DEFAULT:
> raise AttributeError(
"%s does not have the attribute %r" % (target, name)
@ -725,7 +723,7 @@ Now, if we run our tests, we see the failure that I originally expected, or at l
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, mock-3.5.1, snapshottest-0.6.0
collected 6 items
collected 6 items
tests/test_list_missing_audios.py .....F [100%]
@ -778,7 +776,7 @@ Our tests are now passing:
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, mock-3.5.1, snapshottest-0.6.0
collected 6 items
collected 6 items
tests/test_list_missing_audios.py ...... [100%]
@ -822,7 +820,7 @@ def list_missing_audios(course):
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, mock-3.5.1, snapshottest-0.6.0
collected 7 items
collected 7 items
tests/test_list_missing_audios.py ....... [100%]
@ -877,7 +875,7 @@ If we run the tests, we get the error that we expected:
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, mock-3.5.1, snapshottest-0.6.0
collected 8 items
collected 8 items
tests/test_list_missing_audios.py .......F [100%]
@ -934,13 +932,12 @@ def test_returns_correct_audio_id_2(mocker):
assert list(list_missing_audios(fakes.course1))[0][0] == "foobar"
```
```console
==================================== test session starts =====================================
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, mock-3.5.1, snapshottest-0.6.0
collected 9 items
collected 9 items
tests/test_list_missing_audios.py ........F [100%]
@ -1006,7 +1003,7 @@ Just checking that the tests still pass...
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/kdani/repos/LibreLingo/apps/librelingo_audios
plugins: pyfakefs-4.4.0, mock-3.5.1, snapshottest-0.6.0
collected 9 items
collected 9 items
tests/test_list_missing_audios.py ......... [100%]

View File

@ -40,6 +40,7 @@ In order to install the dependencies of this project, you will need to have some
development tools installed.
#### Ubuntu
If you are on Ubuntu, run this command in order to make sure you have all the basic dependencies:
```bash
@ -94,6 +95,7 @@ yarn install
```
#### Starting the development server
Start the development server:
```sh
@ -112,12 +114,11 @@ in the frontend, you need to be able to export YAML courses locally.
You will need [Poetry](https://python-poetry.org/). If you don't have Poetry, you can install it with
```bash
curl -sSL https://install.python-poetry.org | python -
curl -sSL https://install.python-poetry.org | python -
```
For more information, check out [Poetry's official documentation](https://python-poetry.org/docs/#installation).
#### Install dependencies using Poetry
Install dependencies at the top level and for the apps:
@ -142,8 +143,8 @@ need to install courses locally and export them from YAML to JSON.
#### Install courses
The following command installs all courses listed in the courses.json file just like
in production. *Keep in mind that in order to use them in the frontend, the courses
also need to be exported!*
in production. _Keep in mind that in order to use them in the frontend, the courses
also need to be exported!_
```bash
yarn web run installAllExternalCourses
@ -167,7 +168,6 @@ You can export a single course using the following command (change the name of t
yarn run exportCourse spanish-from-english
```
## Setting up Semaphore CI in a clone
In order for Semaphore CI to correctly operate, you will need to set up certain secrets.
@ -178,9 +178,9 @@ This might not be necessary for you in all cases, but it cannot be avoided if yo
Here's a list of the tokens you need to set up. Each of them is a link to a page explaining how to obtain the token:
* [GH\_TOKEN](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
* [KNAPSACK\_PRO\_TEST\_SUITE\_TOKEN\_CYPRESS](https://www.npmjs.com/package/@knapsack-pro/cypress#configuration-steps)
* [PERCY\_TOKEN](https://docs.percy.io/docs/environment-variables)
- [GH_TOKEN](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
- [KNAPSACK_PRO_TEST_SUITE_TOKEN_CYPRESS](https://www.npmjs.com/package/@knapsack-pro/cypress#configuration-steps)
- [PERCY_TOKEN](https://docs.percy.io/docs/environment-variables)
## Testing courses using GitHub gists
@ -201,7 +201,6 @@ Keep in mind, that you have to prefix all file names with `librelingo___` and re
So, for example `challenges/animals.json` should be uploaded as the GitHub gist file
`librelingo___challenges___animals.json`.
## Mocks
For mocks in the frontend, LibreLingo uses [MSW](https://mswjs.io/). For Cypress tests, `cy.intercept()` is

71
docs/ui_translation.md Normal file
View File

@ -0,0 +1,71 @@
# User interface translation
## Contribute to UI Translation (Non-Technical)
POEditor is an online platform for collaborative translation and localization management. It allows contributors, both technical and non-technical, to help translate the user interface of LibreLingo into various languages.
To help translate the user interface of LibreLingo and make it more accessible,
[start by joining the project on POEditor here](https://poeditor.com/join/project?hash=jKiKfen2Ye).
## Technical Overview of UI Translation in LibreLingo
This section provides a brief technical overview of UI translation in LibreLingo using the svelte-i18n library for developers.
### Using the Translate Component
Import the Translate component from Translate.svelte and use it as an HTML tag with the key attribute set to the translation key. The text inside the tag serves as a fallback when a translation is not available.
```javascript
import Translate from "../../Translate.svelte";
// ...
<Translate key="course_page.button_practice">Practice</Translate>
<Translate key="course_page.button_continue">Continue learning</Translate>
<Translate key="course_page.button_learn">Learn</Translate>
```
### Translation Keys
Translation keys are unique identifiers used to reference text in the user interface. Contributors will translate these keys to other languages in POEditor.
#### Adding new translation keys
To add new translation keys, please open a [new issue](https://github.com/LibreLingo/LibreLingo/issues/new) on GitHub as this requires a maintainer to import
new keys in POEditor.
### Deliberate Lack of Support for Variables in Translated Text
LibreLingo avoids using variables in translated text to ensure quality and natural flow of translations across different languages, as using variables can lead to difficult problems for translators. Instead, provide separate translation keys for different variations of a sentence, allowing translators to provide natural-sounding translations for each specific case.
### Translating New Pages
By default, pages will be translated to English or the language of the user's browser. However, for pages inside a course, the pages should be translated to the source language of the course to have consistency. To achieve this, you can copy the logic from an existing page and adapt it to the new page.
Here's a simplified code example to help you understand the process:
```javascript
<script lang="ts" context="module">
export async function preload(page) {
const { get_course } = await import("../../../course-client")
const { courseName } = page.params
return await get_course({ courseName })
}
</script>
<script lang="ts">
import { locale } from "svelte-i18n"
export let uiLanguage = null
locale.set(uiLanguage)
</script>
```
In the example above, the [preload function](https://sapper.svelte.dev/docs#Pages) imports and retrieves the course data. Then, the `uiLanguage` variable is set to the desired source language of the course, and the `locale.set(uiLanguage)` function is used to set the translation language for the page.
### Updating Translations
Translations are updated periodically in LibreLingo, but this is currently a manual process and is not automated yet. If you want translations to be uploaded and integrated into the project, you can create a [new issue](https://github.com/LibreLingo/LibreLingo/issues/new) on GitHub asking for the translations to be updated.
To request an update, visit the LibreLingo GitHub repository, create a [new issue](https://github.com/LibreLingo/LibreLingo/issues/new), and provide the necessary details about the translations you've contributed. A maintainer will then manually update the translations as needed.

View File

@ -10,8 +10,8 @@
"test:ci": "yarn web test:ci",
"web": "yarn workspace @librelingo/web",
"types": "yarn workspaces run types",
"format": "eslint . --fix --max-warnings=0 && prettier --write apps/**/*.svelte --ignore-path ./.prettierignore_for_svelte",
"lint": "eslint . --max-warnings=0 && prettier --check apps/**/*.svelte --ignore-path ./.prettierignore_for_svelte",
"format": "eslint . --fix --max-warnings=0 && prettier --write apps/**/*.svelte docs --ignore-path ./.prettierignore_for_svelte",
"lint": "eslint . --max-warnings=0 && prettier --check apps/**/*.svelte docs --ignore-path ./.prettierignore_for_svelte",
"exportAllCourses": "./scripts/exportAllYamlCourses.sh",
"exportCourse": "./scripts/exportYamlCourse.sh",
"docs": "poetry run mkdocs serve",