-
Notifications
You must be signed in to change notification settings - Fork 0
/
IdiomaManager.cs
58 lines (52 loc) · 1.44 KB
/
IdiomaManager.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;
using System.Threading;
using System.ComponentModel;
using System.Windows.Forms;
using System.Resources;
using System.IO;
namespace VisionTFI
{
public static class IdiomaManager
{
public static Dictionary<string, string> info = new Dictionary<string, string>();
private static void Cargar(string archivo)
{
info.Clear();
foreach(string linea in File.ReadLines("lang\\"+archivo))
{
// info.Clear();
if (linea.Contains("="))
{
string[] s= linea.Split(new char[] {'='});
info.Add(s[0], s[1]);
}
}
}
public static void CambiarIdioma(string archivo)
{
Properties.Settings config= new Properties.Settings();
config.lang = archivo;
config.Save();
Cargar(archivo);
}
public static void Controles(Form f)
{
foreach(string control in info.Keys)
{
try
{
f.Controls[control].Text = info[control];
}
catch (Exception)
{
throw;
}
}
}
}
}