File tree Expand file tree Collapse file tree 7 files changed +44
-5
lines changed
src/main/java/com/airsaid/localization Expand file tree Collapse file tree 7 files changed +44
-5
lines changed Original file line number Diff line number Diff line change @@ -129,12 +129,18 @@ public void setSelectedTranslator(@NotNull AbstractTranslator selected) {
129129 boolean isNeedAppId = selected .isNeedAppId ();
130130 appIdLabel .setVisible (isNeedAppId );
131131 appIdField .setVisible (isNeedAppId );
132- if (isNeedAppId ) appIdField .setText (selected .getAppId ());
132+ if (isNeedAppId ) {
133+ appIdLabel .setText (selected .getAppIdDisplay () + ":" );
134+ appIdField .setText (selected .getAppId ());
135+ }
133136
134137 boolean isNeedAppKey = selected .isNeedAppKey ();
135138 appKeyLabel .setVisible (isNeedAppKey );
136139 appKeyField .setVisible (isNeedAppKey );
137- if (isNeedAppKey ) appKeyField .setText (selected .getAppKey ());
140+ if (isNeedAppKey ) {
141+ appKeyLabel .setText (selected .getAppKeyDisplay () + ":" );
142+ appKeyField .setText (selected .getAppKey ());
143+ }
138144
139145 String applyAppIdUrl = selected .getApplyAppIdUrl ();
140146 if (!StringUtil .isEmpty (applyAppIdUrl )) {
Original file line number Diff line number Diff line change @@ -87,10 +87,10 @@ public void apply() throws ConfigurationException {
8787
8888 // Verify that the required parameters are not configured
8989 if (selectedTranslator .isNeedAppId () && StringUtil .isEmpty (settingsComponent .getAppId ())) {
90- throw new ConfigurationException ("APP ID not configured" );
90+ throw new ConfigurationException (selectedTranslator . getAppIdDisplay () + " not configured" );
9191 }
9292 if (selectedTranslator .isNeedAppKey () && StringUtil .isEmpty (settingsComponent .getAppKey ())) {
93- throw new ConfigurationException ("Security Key not configured" );
93+ throw new ConfigurationException (selectedTranslator . getAppKeyDisplay () + " not configured" );
9494 }
9595
9696 settingsState .setSelectedTranslator (selectedTranslator );
Original file line number Diff line number Diff line change @@ -97,6 +97,11 @@ public boolean isNeedAppId() {
9797 return SettingsState .getInstance ().getAppId (getKey ());
9898 }
9999
100+ @ Override
101+ public String getAppIdDisplay () {
102+ return "APP ID" ;
103+ }
104+
100105 @ Override
101106 public boolean isNeedAppKey () {
102107 return true ;
@@ -107,6 +112,11 @@ public boolean isNeedAppKey() {
107112 return SettingsState .getInstance ().getAppKey (getKey ());
108113 }
109114
115+ @ Override
116+ public String getAppKeyDisplay () {
117+ return "APP KEY" ;
118+ }
119+
110120 @ Override
111121 public @ Nullable String getApplyAppIdUrl () {
112122 return null ;
Original file line number Diff line number Diff line change @@ -46,12 +46,15 @@ public interface TranslatorConfigurable {
4646 @ Nullable
4747 String getAppId ();
4848
49+ String getAppIdDisplay ();
50+
4951 boolean isNeedAppKey ();
5052
5153 @ Nullable
5254 String getAppKey ();
5355
56+ String getAppKeyDisplay ();
57+
5458 @ Nullable
5559 String getApplyAppIdUrl ();
56-
5760}
Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ public class GoogleApiTranslator extends AbsGoogleTranslator {
3636 return TRANSLATE_URL ;
3737 }
3838
39+ @ Override
40+ public String getAppKeyDisplay () {
41+ return "API Key" ;
42+ }
43+
3944 @ Nullable
4045 @ Override
4146 public String getApplyAppIdUrl () {
Original file line number Diff line number Diff line change @@ -160,6 +160,11 @@ public boolean isNeedAppId() {
160160 return supportedLanguages ;
161161 }
162162
163+ @ Override
164+ public String getAppKeyDisplay () {
165+ return "KEY" ;
166+ }
167+
163168 @ Override
164169 public @ Nullable String getApplyAppIdUrl () {
165170 return APPLY_APP_ID_URL ;
Original file line number Diff line number Diff line change @@ -159,6 +159,16 @@ public class YoudaoTranslator extends AbstractTranslator {
159159 return supportedLanguages ;
160160 }
161161
162+ @ Override
163+ public String getAppIdDisplay () {
164+ return "应用 ID" ;
165+ }
166+
167+ @ Override
168+ public String getAppKeyDisplay () {
169+ return "应用秘钥" ;
170+ }
171+
162172 @ Nullable
163173 @ Override
164174 public String getApplyAppIdUrl () {
You can’t perform that action at this time.
0 commit comments