Any decent how-to guides for dealing with multiple languages?
I have looked the Laravel 5 localisation module, and this seems to designed for UI components, as opposed to volatile data like product information on an e-commerce site. So while I am happy with creating a site where a user can select the language and have menus etc displayed locally, I am unsure as to the best way to go about handling the data.
For instance, take a book shop. You might have two tables:
Table: Book
- id
- title
- author
- bio
- price
- ISBN
Table: Author
- id
- name
- bio
Now, one method of handling this would be to add a country code field to each table. Then it would be a simple matter to pull out the correct record. However, this would result in massive duplication of data. The ISBN and price for instance, would get duplicated across records. If you then had to change the price you would have to do it on all records etc.
Another way would be to have a separate table consisting of:
Table: content
- id
- source_id
- language_id
- text
And the title, author and bio fields would just contain keys referring to the source_id field.
But this would be harder to maintain from the viewpoint of editing the content.
So is there a definitive how to guide out there for doing this properly? It doesn't have to be specific to Laravel.
Please or to participate in this conversation.