Skip to content

Commit

Permalink
Localization feature and en-us & zh-cn dictionaries (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinygrox authored Feb 23, 2020
1 parent 5080e39 commit 806152b
Show file tree
Hide file tree
Showing 20 changed files with 443 additions and 161 deletions.
134 changes: 134 additions & 0 deletions GameData/CommNetConstellation/Localization/en-us.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
Localization
{
en-us
{
#CNC_GUIName_Communication = CNC: Communication
#CNC_GUIName_VesselSetupDialog_title = Vessel - <color=#00ff00>Communication</color>
#CNC_GUIName_AntennaSetup = CNC: Antenna Setup
#CNC_GUIName_AntennaSetupDialog_title = Antenna - <color=#00ff00>Setup</color>

#CNC_getContentCompon_msgLabel = Select one or more antennas to manually build the frequency list instead of the default list. Only deployed antennas can be chosen.
#CNC_getContentCompon_comPowerLabel = Com power: <<1>>
#CNC_getContentCompon_combinableLabel = Combinable
#CNC_getContentCompon_Broadcast = Broadcast
#CNC_getContentCompon_DeselectButton = Deselect all
#CNC_getContentCompon_SelectButton = Select all
#CNC_getContentCompon_msgLabel2 = Change the frequency of each antenna.
#CNC_getContentCompon_nameLabel = Name: <<1>>
#CNC_getContentCompon_usageLabel = In Use
#CNC_getContentCompon_ManagementTools = Management tools
#CNC_getContentCompon_msgLabel3 = Decide how the vessel's frequency list should be updated whenever one antenna is changed (eg extended/retracted or frequency change).
#CNC_getContentCompon_AutoBuild = Auto Build
#CNC_getContentCompon_descriptionLabel1 = Rebuild the list from all antennas automatically
#CNC_getContentCompon_LockList = Lock List
#CNC_getContentCompon_descriptionLabel2 = Disallow any change in the current list (except for staging)
#CNC_getContentCompon_msgLabel4 = Set up the master frequency in one go. All antennas will be assigned to this frequency, and Comm powers of those deployed antennas will be combined.
#CNC_getContentCompon_membershipLabel = Talk to constellation members only

#CNC_getConstellationName_Constellation = Constellation
#CNC_getConstellationName_Unrecognised = <b>Constellation</b>: Unrecognised
#CNC_getConstellationName_FreqUnrecognised = This frequency is unrecognised.

#CNC_Generic_No = No
#CNC_Generic_Yes = Yes
#CNC_Generic_Apply = Apply
#CNC_Generic_Close = Close
#CNC_Generic_Mapbutton = Map
#CNC_Generic_Editbutton = Edit
#CNC_Generic_Setupbutton = Setup
#CNC_Generic_Resetbutton = Reset
#CNC_Generic_Addbutton = Add
#CNC_Generic_DeleteButton = Delete
#CNC_Generic_UpdateButton = Update
#CNC_Generic_CancelButton = Cancel
#CNC_Generic_DropButton = Drop
#CNC_Generic_FrequencyLabel = Frequency
#CNC_Generic_nameLabel = Name
#CNC_Generic_PublicButton = Revert to public

#CNC_AntennaSetup_DescText1 = Something
#CNC_AntennaSetup_DescText2 = You are configuring this antenna '<<1>>'
#CNC_AntennaSetup_NameLabel = Name
#CNC_AntennaSetup_ResetButton = Reset

#CNC_ColorPicker_newColorLabel = New
#CNC_ColorPicker_CurrentColorLabel = Current
#CNC_ColorPicker_HexColorLabel = Or hex color
#CNC_ColorPicker_HexGoButton = Parse

#CNC_ConstellationControl_listComponments = Manage communication networks of ground, air and space vessels.
#CNC_ConstellationControl_ConstellationBtn = Constellations
#CNC_ConstellationControl_GroundstationBtn = Ground Stations
#CNC_ConstellationControl_VesselBtn = CommNet Vessels
#CNC_ConstellationControl_createButton = New constellation
#CNC_ConstellationControl_numSatsLabel = <<1>> vessels
#CNC_ConstellationControl_resetPublicMsg = Revert to the default name '<<1>>' and color <<2>>?
#CNC_ConstellationControl_Dialog_title = Constellation
#CNC_ConstellationControl_DeleteDialog_title = Deleting '<<1>>'?
#CNC_ConstellationControl_DeleteDialog_msg = All the vessels of Constellation '<<1>>' will be reintegrated into the public constellation.
#CNC_ConstellationControl_NewConstellation_title = Constellation - <color=#00ff00>New</color>
#CNC_ConstellationControl_EditConstellation_title = Constellation - <color=#00ff00>Edit</color>
#CNC_ConstellationControl_sortLabel = Sort by
#CNC_ConstellationControl_launchSortBtn = Launch time
#CNC_ConstellationControl_freqSortBtn = Strongest frequency
#CNC_ConstellationControl_nameSortBtn = Vessel name
#CNC_ConstellationControl_bodySortBtn = Celestial body
#CNC_ConstellationControl_locationLabel = Orbiting: <<1>>
#CNC_ConstellationControl_getFreqString = Frequencies:
#CNC_ConstellationControl_LatitudeAndLongitude = LAT: <<1>>\nLON: <<2>>
#CNC_ConstellationControl_getFreqString_nothing = No frequency assigned
#CNC_ConstellationControl_vesselSetup_title = Vessel - <color=#00ff00>Setup</color>
#CNC_ConstellationControl_GroundStationEdit_title = Ground station - <color=#00ff00>Edit</color>
#CNC_ConstellationControl_toggleStationButton = Hide all station markers

#CNC_ConstellationEdit_description = You are creating a new constellation.
#CNC_ConstellationEdit_description2 = You are editing Constellation '<<1>>'.
#CNC_ConstellationEdit_actionButtonText_Create = Create

#CNC_GroundStationEdit_desc = You are editing the ground station '<<1>>'.
#CNC_GroundStationEdit_freqLabel = New frequency

#CNC_VesselSetup_nofreqMessage = No active frequency to broadcast!
#CNC_VesselSetup_desc = Active frequencies allow this vessel '<<1>>' to talk with other vessels, which share one or more of these frequencies.
#CNC_VesselSetup_ActiveFrequencies = Active frequencies
#CNC_VesselSetup_CombinedCommPower = Combined Comm Power

#CNC_CommNetConstellation_title = CommNet Constellation - <color=#00ff00>Control Panel</color>

#CNC_Constellation_getName = Not-Found
#CNC_CNCCommNetHome_freqlist = Broadcasting in
#CNC_CNCCommNetHome_frequency = ~ frequency

#CNC_ToolsNames_UpdateList = Update List
#CNC_ToolsNames_AntennaSelection = Antenna Selection
#CNC_ToolsNames_AntennaConfigs = Antenna Configs
#CNC_ToolsNames_MasterFrequency = Master frequency

//Connection Displays
#CNC_DisplayMode_Path = Active Connection
#CNC_DisplayMode_MultiPaths = All Active Connections

//Screen Messages
#CNC_ScreenMsg_isFreqListEditable = Frequency list of Vessel '<<1>>' is locked.
#CNC_ScreenMsg_toggleAntenna = Antenna '<<1>>' is not deployed.
#CNC_ScreenMsg_FreqUpdate = Frequency is updated to <<1>>
#CNC_ScreenMsg_NameUpdate = Antenna is renamed to '<<1>>'
#CNC_ScreenMsg_ConstellationCreated = New constellation '<<1>>' of frequency <<2>> is created
#CNC_ScreenMsg_ConstellationFreqUpdate = Constellation has the new frequency <<1>>
#CNC_ScreenMsg_ConstellationNameUpdate = Constellation is renamed to '<<1>>'
#CNC_ScreenMsg_ConstellationColorUpdate = Constellation color becomes '<<1>>'
#CNC_ScreenMsg_GroundStationNameUpdate = Ground station is renamed to '<<1>>'
#CNC_ScreenMsg_GroundStationColorUpdate = Ground station is '<<1>>' now
#CNC_ScreenMsg_GroundStationFreqUpdate = Ground station's frequency list is updated

#CNC_CheckName_Empty = Name cannot be empty
#CNC_CheckFrequency_negative = Frequency cannot be negative
#CNC_CheckFrequency_Valid = Frequency must be between 0 and <<1>>
#CNC_CheckFrequency_Format = Frequency must be numeric only
#CNC_CheckFrequency_Overflow = Frequency must be equal to or less than <<1>>
#CNC_CheckFrequency_Exist = Please choose an existing constellation
#CNC_CheckFrequency_Locked = Public frequency <<1>> is locked
#CNC_CheckFrequency_InUse = Frequency is in use already
#CNC_CheckFrequency_Contained = Ground station has this frequency already
}
}
134 changes: 134 additions & 0 deletions GameData/CommNetConstellation/Localization/zh-cn.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
Localization
{
zh-cn
{
#CNC_GUIName_Communication = CNC: 通讯
#CNC_GUIName_VesselSetupDialog_title = 载具 - <color=#00ff00>通讯</color>
#CNC_GUIName_AntennaSetup = CNC: 天线配置
#CNC_GUIName_AntennaSetupDialog_title = 天线 - <color=#00ff00>配置</color>

#CNC_getContentCompon_msgLabel = 选择一个或多个天线手动构建频段列表, 而不是默认自建列表. 只能选择已展开的天线.
#CNC_getContentCompon_comPowerLabel = 通信功率: <<1>>
#CNC_getContentCompon_combinableLabel = 可叠加
#CNC_getContentCompon_Broadcast = 广播
#CNC_getContentCompon_DeselectButton = 取消全选
#CNC_getContentCompon_SelectButton = 全选
#CNC_getContentCompon_msgLabel2 = 单独更改每个天线使用的频段.
#CNC_getContentCompon_nameLabel = 名称: <<1>>
#CNC_getContentCompon_usageLabel = 使用中
#CNC_getContentCompon_ManagementTools = 管理工具
#CNC_getContentCompon_msgLabel3 = 当一个天线状态变化时(如展开/收回天线或改变频段), 应如何更新载具天线的频段列表.
#CNC_getContentCompon_AutoBuild = 自动生成
#CNC_getContentCompon_descriptionLabel1 = 根据天线自动构建频段列表
#CNC_getContentCompon_LockList = 锁定列表
#CNC_getContentCompon_descriptionLabel2 = 不允许对当前列表进行任何更改(分级时除外)
#CNC_getContentCompon_msgLabel4 = 一次性设置载具天线的主频段. 其所有天线频段都将被分配到设置值, 已展开的天线的通信功率将被合并.
#CNC_getContentCompon_membershipLabel = 只与同一星座的卫星进行通讯连接

#CNC_getConstellationName_Constellation = 星座
#CNC_getConstellationName_Unrecognised = <b>星座</b>: 未识别
#CNC_getConstellationName_FreqUnrecognised = 无法识别此频段.

#CNC_Generic_No = 否
#CNC_Generic_Yes = 是
#CNC_Generic_Apply = 应用
#CNC_Generic_Close = 关闭
#CNC_Generic_Mapbutton = 绘制
#CNC_Generic_Editbutton = 编辑
#CNC_Generic_Setupbutton = 配置
#CNC_Generic_Resetbutton = 重置
#CNC_Generic_Addbutton = 添加
#CNC_Generic_DeleteButton = 删除
#CNC_Generic_UpdateButton = 更新
#CNC_Generic_CancelButton = 取消
#CNC_Generic_DropButton = 删除
#CNC_Generic_FrequencyLabel = 频段
#CNC_Generic_nameLabel = 名称
#CNC_Generic_PublicButton = 还原为公共频段

#CNC_AntennaSetup_DescText1 = 一些东西
#CNC_AntennaSetup_DescText2 = 你正在配置天线 '<<1>>'
#CNC_AntennaSetup_NameLabel = 名称
#CNC_AntennaSetup_ResetButton = 重置

#CNC_ColorPicker_newColorLabel = 添加
#CNC_ColorPicker_CurrentColorLabel = 当前
#CNC_ColorPicker_HexColorLabel = 或使用十六进制颜色
#CNC_ColorPicker_HexGoButton = 解析

#CNC_ConstellationControl_listComponments = 管理地面、空中和太空载具的通信网络.
#CNC_ConstellationControl_ConstellationBtn = 星座组网
#CNC_ConstellationControl_GroundstationBtn = 地面站
#CNC_ConstellationControl_VesselBtn = 通信网络载具
#CNC_ConstellationControl_createButton = 建立星座
#CNC_ConstellationControl_numSatsLabel = <<1>> 个载具
#CNC_ConstellationControl_resetPublicMsg = 还原为默认名称 '<<1>>' 和颜色 <<2>> 吗?
#CNC_ConstellationControl_Dialog_title = 星座
#CNC_ConstellationControl_DeleteDialog_title = 删除'<<1>>'?
#CNC_ConstellationControl_DeleteDialog_msg = 所有星座"<<1>>"中的载具将重新整合到公共星座中.
#CNC_ConstellationControl_NewConstellation_title = 星座 - <color=#00ff00>新建</color>
#CNC_ConstellationControl_EditConstellation_title = 星座 - <color=#00ff00>编辑</color>
#CNC_ConstellationControl_sortLabel = 类型排序
#CNC_ConstellationControl_launchSortBtn = 发射时间
#CNC_ConstellationControl_freqSortBtn = 频段强度
#CNC_ConstellationControl_nameSortBtn = 载具名称
#CNC_ConstellationControl_bodySortBtn = 天 体
#CNC_ConstellationControl_locationLabel = 在轨天体: <<1>>
#CNC_ConstellationControl_getFreqString = 频段:
#CNC_ConstellationControl_LatitudeAndLongitude = 纬度: <<1>>\n经度: <<2>>
#CNC_ConstellationControl_getFreqString_nothing = 未分配频段
#CNC_ConstellationControl_vesselSetup_title = 载具 - <color=#00ff00>配置</color>
#CNC_ConstellationControl_GroundStationEdit_title = 地面站 - <color=#00ff00>编辑</color>
#CNC_ConstellationControl_toggleStationButton = 隐藏所有地面站标记

#CNC_ConstellationEdit_description = 你正在建立一个新的星座.
#CNC_ConstellationEdit_description2 = 你在编辑星座 '<<1>>'.
#CNC_ConstellationEdit_actionButtonText_Create = 创建

#CNC_GroundStationEdit_desc = 你在编辑地面站 '<<1>>'.
#CNC_GroundStationEdit_freqLabel = 新增频段

#CNC_VesselSetup_nofreqMessage = 没有可用的频段可供广播!
#CNC_VesselSetup_desc = 可用频段列表可以让载具'<<1>>'使用其中的一个或多个频段来与其他载具进行通信.
#CNC_VesselSetup_ActiveFrequencies = 可用频段
#CNC_VesselSetup_CombinedCommPower = 合并通信功率

#CNC_CommNetConstellation_title = 通信网络星座 - <color=#00ff00>控制面板</color>

#CNC_Constellation_getName = 未找到
#CNC_CNCCommNetHome_freqlist = 广播
#CNC_CNCCommNetHome_frequency = ~ 频段

#CNC_ToolsNames_UpdateList = 更新列表
#CNC_ToolsNames_AntennaSelection = 天线选择
#CNC_ToolsNames_AntennaConfigs = 天线配置
#CNC_ToolsNames_MasterFrequency = 主频段

//Connection Displays
#CNC_DisplayMode_Path = 通信链路
#CNC_DisplayMode_MultiPaths = 所有通信链路

//Screen Messages
#CNC_ScreenMsg_isFreqListEditable = 载具"<<1>>"的频段列表已锁定.
#CNC_ScreenMsg_toggleAntenna = 天线"<<1>>"未展开.
#CNC_ScreenMsg_FreqUpdate = 频段已更改为<<1>>
#CNC_ScreenMsg_NameUpdate = 天线重命名为'<<1>>'
#CNC_ScreenMsg_ConstellationCreated = 频段为<<2>>的星座"<<1>>"已创建
#CNC_ScreenMsg_ConstellationFreqUpdate = 星座新增频段<<1>>
#CNC_ScreenMsg_ConstellationNameUpdate = 星座重命名为"<<1>>"
#CNC_ScreenMsg_ConstellationColorUpdate = 星座颜色变为"<<1>>"
#CNC_ScreenMsg_GroundStationNameUpdate = 地面站改名为"<<1>>"
#CNC_ScreenMsg_GroundStationColorUpdate = 地面站颜色为"<<1>>"
#CNC_ScreenMsg_GroundStationFreqUpdate = 地面站频段表已更新

#CNC_CheckName_Empty = 名字不能为空
#CNC_CheckFrequency_negative = 频段值不能为负数
#CNC_CheckFrequency_Valid = 频段值只能在0和<<1>>之间
#CNC_CheckFrequency_Format = 频段值必须为数字
#CNC_CheckFrequency_Overflow = 频段值必须要小于等于<<1>>
#CNC_CheckFrequency_Exist = 请选择一个现有的星座
#CNC_CheckFrequency_Locked = 公共频段<<1>>已锁定
#CNC_CheckFrequency_InUse = 该频段已经在使用中
#CNC_CheckFrequency_Contained = 地面站已经有这个频段了
}
}
5 changes: 3 additions & 2 deletions src/CommNetConstellation/CommNetConstellation.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using UnityEngine;
using CommNetConstellation.UI;
using KSP.UI.Screens;
using KSP.Localization;

namespace CommNetConstellation
{
Expand All @@ -19,7 +20,7 @@ protected override void Launch()
{
if (this.controlDialog == null)
{
this.controlDialog = new ConstellationControlDialog("CommNet Constellation - <color=#00ff00>Control Panel</color>");
this.controlDialog = new ConstellationControlDialog(Localizer.Format("#CNC_CommNetConstellation_title"));//"CommNet Constellation - <color=#00ff00>Control Panel</color>"
}
this.controlDialog.launch();
}
Expand Down Expand Up @@ -49,7 +50,7 @@ protected virtual void Launch()
{
if (this.controlDialog == null)
{
this.controlDialog = new ConstellationControlDialog("CommNet Constellation - <color=#00ff00>Control Panel</color>");
this.controlDialog = new ConstellationControlDialog(Localizer.Format("#CNC_CommNetConstellation_title"));//"CommNet Constellation - <color=#00ff00>Control Panel</color>"
}
this.controlDialog.launch();
}
Expand Down
2 changes: 1 addition & 1 deletion src/CommNetConstellation/CommNetConstellation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
6 changes: 3 additions & 3 deletions src/CommNetConstellation/CommNetLayer/CNCCommNetHome.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ public void OnGUI()
GUI.Label(headlineRect, this.stationName, CNCCommNetHome.groundStationHeadline);

//frequency list
string freqStr = "No frequency assigned";
string freqStr = Localizer.Format("#CNC_ConstellationControl_getFreqString_nothing");//"No frequency assigned"

if (Frequencies.Count > 0)
{
freqStr = "Broadcasting in";
freqStr = Localizer.Format("#CNC_CNCCommNetHome_freqlist");//"Broadcasting in"
for (int i = 0; i < Frequencies.Count; i++)
freqStr += "\n~ frequency " + Frequencies[i];
freqStr += "\n" + Localizer.Format("#CNC_CNCCommNetHome_frequency") + " " + Frequencies[i];//"~ frequency"
}

headlineRect = groundStationRect;
Expand Down
12 changes: 6 additions & 6 deletions src/CommNetConstellation/CommNetLayer/CNCCommNetUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ public class CNCCommNetUI : CommNetUI
/// </summary>
public enum CustomDisplayMode
{
[Description("None")]
[Description("#autoLOC_6003083")]//None
None,
[Description("First Hop")]
[Description("#autoLOC_6003084")]//First Hop
FirstHop,
[Description("Active Connection")]
[Description("#CNC_DisplayMode_Path")]//Active Connection
Path,
[Description("Vessel Links")]
[Description("#autoLOC_6003086")]//Vessel Links
VesselLinks,
[Description("Network")]
[Description("#autoLOC_6003087")]//Network
Network,
[Description("All Active Connections")]
[Description("#CNC_DisplayMode_MultiPaths")]//All Active Connections
MultiPaths
}

Expand Down
Loading

0 comments on commit 806152b

Please sign in to comment.