|
using System.Collections.Generic;
using System.Globalization;
using System.IO;
/// <summary>
/// Class to manage language on the website
/// </summary>
public sealed class LanguageManager
{
public static CultureInfo DefaultCulture = new CultureInfo("en-US");
private CultureInfo _currentCulture;
public LanguageManager()
: this(DefaultCulture)
{
}
public LanguageManager(CultureInfo cultureInfo)
{
_currentCulture = cultureInfo;
}
public CultureInfo CurrentCulture
{
get { return _currentCulture; }
set { _currentCulture = value; }
}
public CultureInfo[] AvailableCultures
{
get
{
List<CultureInfo> result = new List<CultureInfo>();
//
//Only show culture that according resource can be found
//
List<string> availableResources = new List<string>();
string resourcespath = Path.Combine(System.Web.HttpRuntime.AppDomainAppPath, "App_GlobalResources");
DirectoryInfo dirInfo = new DirectoryInfo(resourcespath);
foreach (FileInfo fi in dirInfo.GetFiles("lang.*.resx", SearchOption.AllDirectories))
{
//Take the cultureName from resx filename, will be smt like en-US
string cultureName = fi.Name.Replace("lang.", string.Empty).Replace(".resx", string.Empty);
availableResources.Add(cultureName);
}
foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{
//If language file can be found
if (availableResources.Contains(culture.ToString()))
{
result.Add(culture);
}
}
return result.ToArray();
}
}
public string this[string key]
{
get
{
string @string = Resources.lang.ResourceManager.GetString(key, _currentCulture);
//if no value found, get value in default resource
if (@string == string.Empty) @string = Resources.lang.ResourceManager.GetString(key);
return (@string != string.Empty) ? @string : key; //if no value found, return key
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
PERSONAL DETAILS
Full Name : Nguyen Thanh Tung
Sex : Male
Date of Birth : October 06, 1983
Nationality : Vietnamese
PERSONAL PROFILE
Trustworthy, efficient, capable work under pressure, outgoing person and capable work in a team.
AREA OF EXPERTISE
- Proficient in Programming: .Net 1.0/1.1/2.0/3.0/3.5 (C#, VB.Net, ASP.Net,
AJAX, WCF, WWF), VB4/5/6, ASP, PHP, HTML, CSS, Script, XML.
Experience with Vs Source Safe, Team System, MsBuild, SVN/CVS. Knowledge about
UnitTest, Test-Driven development.
- Experience with Databases: SQL Server 2000/2005, MySQL
4.x/5.x/6.x, Oracle, PostgreSQL, Ms. Access.
- Experience in EIS: ERP, CRM, SCM ...
- Experience with Microsoft Products: CRM3/4, Sharepoint
2003/2007 ... - Proficient in OS: Linux (Redhat, Fedora, Mandrake, Suse), Windows (2000/2003
Server, XP, Vista).
- Proficient in Graphics (Flash, Photoshop, 3DMax …); Microsoft Office, Visio,
Microsoft Project.
- Proficient in Network Devices: Router, Switch, Firewall Server, Mail Server,
FTP Server, DNS, VPN.
Experience in Servers: IBM, HP, Sun, Dell ...
- Familiar with OO and SOA concepts.
- Knowledge about project management: CMMI, Agile and Scrum, Software
Engineering, System Analysis and Design, IT Project Management.
- Knowledge in Accounting and Finance: Financial Statement, Income
Statement ...
MAIN PROJECTS DONE IN THE PAST
- SMS Gateway.
- POP3-IMAP-SMTP App.
- Products Management Sys.
- Hedge Fund Management Sys.
- Motion detection.
- 3D games engine (C# using OpenGL Lib).
- Video Conference.
- Information Retrieval.
- Microsoft CRM3/4
- Microsoft Sharepoint Portal 2003/2007
- CMS
- E-Commerce