Skip to content

多语言的一小步 #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions TimeControl/Lang/Lang.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.ApplicationModel.Store;

namespace TimeControl.Lang
{
internal static class App
{
private static LangModel[] src =
{
new LangModel(),

new LangModel
{
Info = new LangInfo {
Contributer = "GreatHuang2007"},
Name = new LangName{
InternalName = "en",
DisplayName = "English"},
TimeControl = "Computer Time Control",
planner = "Schedule Editor",
taskstart = "Start selected task",
taskend = "Mark selected as completed",
plan = "Schedule",
focus = "Focus",
startlock = "Unlock in minutes",
whitelistapps = "Path of the programs wished to use (Line by line)",
deepFocus = "Deep focus",
dfWarning = "ONCE you click the Unlock button, your device will IMMEDIATELY SHUTDOWN. And during the time you set, you computer will automatically shutdown if this program is included in Windows scheduled tasks list."
}
};

private static LangModel Current = src[1];

public static List<LangName> getLangList()
{
List<LangName> res = new List<LangName>();
foreach (LangModel i in src)
res.Add(i.Name);
return res;
}

public static LangModel getCurrent() { return Current; }

public static void setCurrent(LangModel i) { Current = i; }
}
}
41 changes: 41 additions & 0 deletions TimeControl/Lang/LangModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TimeControl.Lang
{
internal class LangName
{
public string InternalName;
public string DisplayName;
};

internal class LangInfo
{
public string Contributer;
}
internal class LangModel
{
public LangInfo Info = new LangInfo
{
Contributer = "SamHou0"
};
public LangName Name = new LangName
{
InternalName = "zh-cn",
DisplayName = "中文(简体)"
};
public string TimeControl = "时间管理";
public string planner = "打开日程编辑器";
public string taskstart = "开始日程";
public string taskend = "标记完成日程";
public string plan = "日程计划";
public string focus = "专注屏保";
public string startlock = "启动屏保(分)";
public string whitelistapps = "白名单应用路径(一行一个)";
public string deepFocus = "深度专注";
public string dfWarning = "启动屏保后,计算机将立刻关机,并在持续时间内开机时自动关闭。(必须设置开机启动)";
};
}
38 changes: 20 additions & 18 deletions TimeControl/Windows/ControlPanel.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions TimeControl/Windows/ControlPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ private void ReadTasks()
{
tasks = TCFile.ReadTasks();
}
else { tasks = null; }
else
{ tasks = null; }
RefreshTasks();
}

Expand Down Expand Up @@ -352,7 +353,8 @@ private void ProcessMonitorTimer_Tick(object sender, EventArgs e)
{
foreach (string str in titleListBox.Items)
{
if (process.MainWindowTitle.Contains(str)) process.Kill();
if (process.MainWindowTitle.Contains(str))
process.Kill();
}
}
}
Expand Down Expand Up @@ -489,9 +491,11 @@ private bool CheckStop()
{
return true;
}
else return false;
else
return false;
}
else return true;
else
return true;
}

private void StopCheckBox_CheckedChanged(object sender, EventArgs e)
Expand Down