Understand spoken language

Content synchronisation

Submitted by admin on 24 July 2017

Home site

The home site will contain a central record of all the common data on each of the language-specific sites, e.g.

  • the picture for any given word
  • the picture copyright information
  • the lessons which a particular word belongs in (e.g. that the word "dog" belongs in the Animals lesson, the Pets lesson, and the Nouns lesson)

By keeping this common data in one place it means that we can share the data more easily between the different language versions.

The home site will also keep a copy of all the translations. For example, it will store the word "dog" together with the translations, e.g.:

One site, one language 

When I (Hugh) first set up Lingopolo with several languages, I put every language into a single Drupal instance. Although that sounds like it should be the best way to organise the site, in practice it was a nightmare, as every single part of the site, every view, every lesson, had to be completely aware of the different languages. It was very difficult to get it right. By separating each language into a separate instance, it has simplified every site, and made it difficult to get it wrong. Of course in some ways it is more complex having a different site for each language, but overall I still think it is much easier overall.

Editing done on language sites

All the editing of fields will be done on specific language versions and then synchronised as need be. For example, even though the Home site is the source of truth for the images, the image for "dog" can be done directly on any of the language sites and the result will be synchronised first with the Home site, and then from the Home site to the other language versions.

Duplicate data

Generally in computing we avoid having duplicate data. That's because whenever you have duplicate data you're never quite sure which is the correct version. In Lingopolo we allow a degree of duplication.

The reason is the ability of having every language site able to run completely and totally independently. For example, we store the picture for the word "dog" on every language version with the word "dog". This means we have duplication, but it also means we have a huge amount of:

  • simplicity; we are not trying to build the page for the word "dog" where the translation is on one instance and the picture is on another instance 
  • speed; keeping everything needed for a single instance in that instance makes things faster 
  • independance; we can actually run each language instance on a different web host

Communication between the instances

Communication is done via web services (rather than, for example, reading directly another site database). Although this is a fairly slow method, it means that we are avoiding database specific code, and, more importantly, allowing each site to be hosted completely independently.

Since the web services are only used to synchronise data, and not for real time display, the slow time of using web services is not an issue.

One source of truth

Duplication of data such as the photos means we have to be careful which site is the source of the truth, i.e. when two values are different, such as the photo for a dog between the Home site and the Thai site, which version is the correct one? This will vary by field.

The home site will generally be the source of truth for the common data (e.g. images, image source URL, lessons for each word). The language specific sites will be the source of truth for the data which are specific to them (e.g. the French site is the source of truth for the translation of the word "dog" into French).

Field by field

English

The language sites themselves are the source of truth for the English. That means that if the French site renames the word "dog" as "doggie" then the Home site will need to adjust.

If the Home site does not have a word "doggie" then it will need to create one. The Home site will remove its own French translation from the word "dog" on the Home site. The translation from the word "doggie" will come from the French site.

Note that if the Home site has an English word with no foreign version, then that word can be deleted from the Home site.

Foreign (Thai, French, ...)

The language sites themselves are the source of truth for the English. That means that if the French site changes the translation of the word "dog", then the Home site should change to match.

Image

The Home site is the source of truth for images. That means that when an image is changed on a language site, the language site must inform the Home site of the change.

For example, if the word "dog" on the FR site gets a new image for dog, then the FR site will send the image and the image source URL to the Home site (alternatively the FR site could just tell the Home site that the image has changed, and the Home site could pull the image and image source from the FR site).

Image Source URL

The Home site is the source of truth. 

Lessons

The Home site is the source of truth.