forked from fehaar/FFWD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetLocale.cs
41 lines (36 loc) · 1.07 KB
/
SetLocale.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System.Globalization;
using System.Threading;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace PressPlay.FFWD.BuildTasks
{
public class SetLocale : Task
{
private string locale = "en-US";
/// <summary>
/// Gets or sets the locale to establish. By default, en-US.
/// </summary>
/// <value>
/// The locale to set.
/// </value>
public string Locale
{
get { return this.locale; }
set { this.locale = value; }
}
[Output]
public string PrevLocale { get; set; }
/// <summary>
/// When overridden in a derived class, executes the task.
/// </summary>
/// <returns>
/// true if the task successfully executed; otherwise, false.
/// </returns>
public override bool Execute ()
{
this.PrevLocale = Thread.CurrentThread.CurrentCulture.Name;
Thread.CurrentThread.CurrentCulture = new CultureInfo (this.Locale);
return true;
}
}
}