users speaking multiple languages

Topics: Localization, Writing modules
Dec 11, 2011 at 8:30 PM

Hi Fokes:

Ok, I'm in the process of creating a website which allows users to state the languages they speak and to what level.

I know there are several localization plugins, in the module gallery.

Do any of them provide me the ability to do this.

What I essentially need is the ability to have a languages part added to the user part (easy to do) that allows the user to select 3 aditional languages.

I could use an IList, but then How do I limit the number of entries the list/underlying database table can contain without getting in to NHibernate specific stuff? what would I need to do if I want to go down this route?

I could split the languages out in to there own collumns, but I  don't really want to, unless this is the best way to do things.

Any help apreciated.

Cheers

Sean. 

Coordinator
Dec 12, 2011 at 5:44 AM

The localization module has a part that you can in principle add to any content type to make it localizable.

Dec 12, 2011 at 7:59 PM

Hi:

I now have the following class structure to manage this:

public class UserLanguageCompitencyRecord

{

public virtual int Id { get; set; }

public virtual string Name { get; set; }

public virtual string Description { get; set; }

}

public class UserLanguageRecord

{

public virtual int Id { get; set; }

public virtual string Name { get; set; }

}

public class ContentUserSpokenLanguageRecord

{

public virtual int Id { get; set; }

public virtual UserLanguageRecord Language { get; set; }

public virtual UserLanguageCompitencyRecord Compitency { get; set; }

}

public class UserSpokenLanguagesPartRecord : ContentPartRecord

{

public UserSpokenLanguagesPartRecord()

{

UserSpokenLanguages = new List<ContentUserSpokenLanguageRecord>();

}

public virtual IList<ContentUserSpokenLanguageRecord> Languages { get; set; }

}

public class UserSpokenLanguagesPart : ContentPart<UserSpokenLanguagesPartRecord>

{

public IEnumerable<UserSpokenLanguagesPartRecord> Languages

{

get

{

return Record.Languages.Select(r => r.UserSpokenLanguagesPartRecord);

}

}

}

I have two queries from this:

Firstly, if I add this to the user content part in the migration, will this structure keep track of the languages for multiple users or is there something else I need to do, if I look at the documentation regarding creating realationships this is implied.

Secondly the userLanguageCompitencyRecord in the database will be populated in the migration. What is the easies way of listing this for display on to the view, have a content part for the language competency, or have a repository and call this from the service.

Finally, how do UI go about adding JQuery to a view, are there any examples in the module gallery/included with orchard.

Cheers

Sean.

From: bertrandleroy [email removed]
Sent: 12 December 2011 05:44
To: Sean Farrow
Subject: Re: users speaking multiple languages [orchard:282576]

From: bertrandleroy

The localization module has a part that you can in principle add to any content type to make it localizable.

Coordinator
Jan 6, 2012 at 1:12 AM

No, that won't work. I would recommend you read http://docs.orchardproject.net/Documentation/Creating-1-n-and-n-n-relations

To include jQuery, just @Script.Require("jQuery")