We're building an education platform. The site it's going to be published in different countries, having each country its own subfolder. For example,
France: http://myedusite.com/fr/
Spain: http://myedusite.com/es/
The site has courses belonging to providers
courses have different themes (Arts, Business, Science) and these themes have sub-themes (I'm planning to use ancestry to have a tree structure model)
Courses
providers can create courses if they have an account. The courses created will be published only in the domain they were created.
As an example, if I'm a course's provider and I create an account in http://myedusite.com/fr/, then the courses I create should only be published in http://myedusite.com/fr/.
For this purpose, I thought of defining a Country model with the field iso_3166. This field would be populated with the country codes defined in ISO 3166.
Then, the courses would have a target_country (class: Country), enabling the possibility of choosing where the course is published (if the course's target_country is France it should only be visible in http://myedusite.com/fr/).
Themes
For themes happens something similar, where for each country where the site exists there can be different themes. When a user arrives to http://myedusite.com/xx/, only themes existing in country "xx" will be shown. That implies that each theme should belong to a country.
On the other hand, each course would have one theme.
For dealing with country related information (for example loading cities for a country) I thought of using the country gem.
From the business perspective, we have chosen a bottom-top approach, meaning that only the necessary things are built now, adding features as it's needed.
I see this as a reasonable strategy to make the site international. What I'm afraid of is of choosing wrong and having trouble on the future as new features arrive. I would like to have as much flexibility as possible.
It's the first time I design an international project. Is the approach I've thought of something usual in this kind of sites? Anything I should pay attention to that I didn't mention?
I use navigator.language to get the locale and redirect from JS to whatever URL I want, or add it as a query string. In your case since you only want the language you should split it first, then redirect. In my case I use the full locale code because en is different from AU, US, CA, GB and so on, you'd probably want to consider doing the same especially if you will be displaying prices, dates and so on.
I think there is a way to get this with Rails too, see the Accept-language, accept charset headers.
Once you pass the language/locale to your controller you can then filter data as required.
This also leaves room for some nice SEO tricks if you set up a custom 404 page, engines will go for this.
Related
We recently had a new business rule that will require our users to pay for individual modules in our web application.
So, all the features we build in the application will not apply to all users. Some users can choose to add features that they want.
I've tried researching into an architecture/mindset to how to approach this development.
If I could get an idea on how to get started with this.. I would very much appreciate it.
I work with .NET web applications, and Microsoft SQL Server.
Thanks.
First list what "objects" or things you need to keep track of.
Users
userid
fullname
can manage his features? You said not all users can
...
Features:
featureid
description
cost
...
UserHasFeature
a link between a user and a feature
each line is userid, featureid
Using this you can query which user has what feature. Or list the users that have access to a particular feature.
In your web app, you will need administrator functions:
users management: add, remove, modify, list
feature: add, remove, modify, list
link management: add, remove, list
Reports: whatever reports you want to have
And user functions:
user: signin, modify, reset password, view all features, view features the user already has, add a new feature, remove a feature
reports: total cost of features the user is using, others
Now this is a very quick first draft. There are a lot of missing requirements:
approval workflow: can a user modify his features without the approbation of X?
payment methods
project number for internal billing
cost structure: monthly, one time, ...?
managers can view the features of the employees he manages?
...
This to remember:
Start with objects in your projet. These become tables.
Characteristics of the objects become fields in your tables.
If the same characteristic appears in many object tables, with the same values, consider creating a new table for these. Ex. in an address, you would not leave the country value as a simple VARCHAR field. You would link to another table with the country values.
List the relations. These become foreign keys, or link tables.
Split your objects. So apply 1NF, 2NF and 3NF at least. It is enough for most applications. (NF == Normal Form).
Each table and links require administrator pages (CRUD)
Users have a limited view related to their features only.
This is a huge subject, I could go on and on, but this could get you started.
Have fun!
First of all, I want to apologize for my terminology. I am not entirely sure what to call what I am looking for, so I can’t google for answers. But here is my problem.
I am working on a Rails application that stores information about different websites and provides various services for them. I will call these services ‘Products.’ One website can be subscribed to several products, and a product can be served to various websites. So here is a very simple association scheme for these relationships:
At least, it would have been simple, but the problem is that the Settings model (shown in red on this diagram) is different for each product: for one product, it will have one number of fields and data types, for another it will have a different number of fields with different data types. On the other hand, the Faq and Description are the same, so if I redraw the diagram as follows:
I will get another problem: too much repetition (shown in blue on the diagram). Ideally, I want some kind of modification of the first diagram, where the Product model will choose differens Settings models depending on a parameter that I pass to it:
So that a request website.products.find(1).settings will return the model Settings1, while a request website.products.find(2).settings will return a completely different model, Settings2.
Is this achievable in Rails? If not, how would you organize such data?
I am getting translators involved to get my opencart shop into multiple languages and I want to pay them on commission for all orders made in their language (not country). At the moment I cannot tell which language a person has ordered in.
Anyone know a way to tell which language a customer was using during checkout.
Ideally this would be built into Opencart or an extension.
This is something that is saved in your database with the order itself (in the order table). You will see there is a field called language_id which relates to the relevant language in the language table. This is the only way to find this information out by default (though there may be mods that let you know this information on the extension store)
I need to create a web app that would be different for each country (and not only different language). Let's say the website lists insurance solutions in the country.
For example, users in France typing example.com would need to be sent to http://france.example.com and American users would go to http://us.example.com
All websites would have the same display/layout but the content in the pages would vary as insurance and companies are not the same in each country.
What I'd like is:
in my backend: Manage multiple "country versions" on which I can work to improve features, layout, etc. in a single time without having to update the code on each version. All country versions would stay in similar stat this way.
in the backend: create a filter that "sends" the insurance item I input in my backoffice into the right country-wesbite.
it means for example that the page describing an insurance ALpha in France would only exist in the france version (http://france.example.com/alpha_insurance_description) and not in other country versions.
What kind of architecture must I implement? Are there Rails gems that answer this kind of problematic? (if not maybe some websites describing how to create this kind of multi-country website)
"multi-tenancy" is what you want. The following two railscasts explains two different approches to achieve the same.
http://railscasts.com/episodes/389-multitenancy-with-postgresql
http://railscasts.com/episodes/388-multitenancy-with-scopes
Also you can use subdomain-fu, for subdomain handling and route validation.
I would just use the geoIP data (or user preferences) to find out which country to show and have the content stored in the DB (e.g. insurance companies) with a country code. Seeing as an insurance company will have an address and postcode anyway, this should be pretty simple. That way, both the content and the site language can be set dynamically.
As for the subdomains, you can CNAME all of them to your main site and use a little piece of Rack middleware (hand rolled) to redirect requests to the right subdomain if necessary. After that, the site ignores the subdomain itself and just server content dynamically. Alternatively, you could have some code in the application config that reads the subdomain from the Rack request, extracts the country code, and sets it as a config variable that you then use to flag what country code to use when showing the dynamica content, setting the language, etc.
I have imported some other languages to my shop. When I change the language, all the fields are changed (items, categories, etc...) but products (name, description) and categories are in English.
I understand these language will not change but I also want those languages to be changed. How can I do that?
you need to change them manually
when you create new language, you'll see its flag next to the input fields, just click it and you can enter the text in that language you select
Prestashop (1.4) comes in 5 languages, and you can get language packs for many other languages (some more complete than others), that were contributed by members.
However, Prestashop will not automatically translate anything that you manually added to your shop (IE Categories, Products, CMS pages, Modules, etc..), you can either manually enter the translations, or you can use a module to automatically translate those using google translate.
You can see an example of a module that does automatic translation at http://www.presto-changeo.com/en/prestashop-modules/19-website-translator.html
Yes, you have to translate them manually. The packs are only available for default products.
You also can install a module to translate it automatically (probably utilizing Google Translate). But if you are selling, I don't think you should do that. As the automatic translation sometimes sounds funny. IT HURTS YOUR PROSPECT CUSTOMERS and you are loosing sale.