Skip to content

Commit e27a823

Browse files
committed
chore: translate license dialog strings
1 parent 80c35b8 commit e27a823

File tree

4 files changed

+50
-29
lines changed

4 files changed

+50
-29
lines changed

src/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"app_name_about": "Phoenix Code",
55
"main_pro_plan": "Phoenix Pro",
66
"about_icon": "styles/images/phoenix-icon.svg",
7-
"account_url": "http://localhost:5000/",
7+
"account_url": "https://account.phcode.dev/",
88
"promotions_url": "https://promotions.phcode.dev/dev/",
99
"purchase_url": "https://phcode.io/pricing",
1010
"how_to_use_url": "https://github.com/adobe/brackets/wiki/How-to-Use-Brackets",

src/nls/root/strings.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1691,5 +1691,25 @@ define({
16911691
"PROMO_PRO_UNLOCK_MESSAGE": "Subscribe now to unlock these advanced features:",
16921692
"PROMO_PRO_TRIAL_DAYS_LEFT": "Phoenix Pro Trial ({0} days left)",
16931693
"GET_PHOENIX_PRO": "Get Phoenix Pro",
1694-
"USER_FREE_PLAN_NAME_DO_NOT_TRANSLATE": "Community Edition"
1694+
"USER_FREE_PLAN_NAME_DO_NOT_TRANSLATE": "Community Edition",
1695+
// license dialogs
1696+
"MANAGE_LICENSE_DIALOG_TITLE": "Manage Device License",
1697+
"LICENSE_KEY": "License Key",
1698+
"LICENSE_KEY_ACTIVATE": "Activate License",
1699+
"LICENSE_KEY_ACTIVATING": "Activating\u2026",
1700+
"LICENSE_KEY_CURRENT": "Current Device License",
1701+
"LICENSE_KEY_CHECKING": "Checking license status\u2026",
1702+
"LICENSE_KEY_NONE": "No active device license found",
1703+
"LICENSE_STATUS_ACTIVE": "Active",
1704+
"LICENSE_INFO_STATUS_LABEL": "Status:",
1705+
"LICENSE_INFO_LICENSED_TO_LABEL": "Licensed to:",
1706+
"LICENSE_INFO_TYPE_LABEL": "License type:",
1707+
"LICENSE_INFO_VALID_UNTIL_LABEL": "Valid until:",
1708+
"LICENSE_CHECK_ERROR": "Error checking license status",
1709+
"LICENSE_STATUS_UNKNOWN": "Unknown",
1710+
"LICENSE_VALID_NEVER": "Never",
1711+
"LICENSE_STATUS_ERROR_CHECK": "Error checking license status",
1712+
"LICENSE_ACTIVATE_SUCCESS": "License activated successfully!",
1713+
"LICENSE_ACTIVATE_FAIL": "Failed to activate license",
1714+
"LICENSE_ENTER_KEY": "Please enter a license key"
16951715
});
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<div class="license-management-dialog modal">
22
<div class="modal-header">
3-
<h1 class="dialog-title">Manage Device License</h1>
3+
<h1 class="dialog-title">{{Strings.MANAGE_LICENSE_DIALOG_TITLE}}</h1>
44
</div>
55

66
<div class="modal-body" style="max-height: 500px; padding: 24px;">
77
<!-- License Activation Section -->
88
<div class="license-activation-section">
99
<div class="license-form-group">
1010
<label for="license-key-input" class="license-form-label">
11-
License Key
11+
{{Strings.LICENSE_KEY}}
1212
</label>
1313
<input
1414
type="text"
@@ -20,9 +20,9 @@ <h1 class="dialog-title">Manage Device License</h1>
2020
<button
2121
id="activate-license-btn"
2222
class="btn primary license-activate-btn">
23-
<span class="btn-text">Activate License</span>
23+
<span class="btn-text">{{Strings.LICENSE_KEY_ACTIVATE}}</span>
2424
<span class="btn-spinner">
25-
<i class="fa fa-spinner fa-spin" style="margin-right: 8px;"></i>Activating...
25+
<i class="fa fa-spinner fa-spin" style="margin-right: 8px;"></i>{{Strings.LICENSE_KEY_ACTIVATING}}
2626
</span>
2727
</button>
2828
</div>
@@ -33,38 +33,38 @@ <h1 class="dialog-title">Manage Device License</h1>
3333
<!-- License Status Section -->
3434
<div class="license-status-section">
3535
<h3 class="license-section-title">
36-
Current Device License
36+
{{Strings.LICENSE_KEY_CURRENT}}
3737
</h3>
3838

3939
<!-- Loading State -->
4040
<div id="license-status-loading" class="license-status-loading">
4141
<i class="fa fa-spinner fa-spin"></i>
42-
<span>Checking license status...</span>
42+
<span>{{Strings.LICENSE_KEY_CHECKING}}</span>
4343
</div>
4444

4545
<!-- No License State -->
4646
<div id="license-status-none" class="license-status-none" style="display: none;">
4747
<i class="fa fa-exclamation-circle"></i>
48-
<span>No active device license found</span>
48+
<span>{{Strings.LICENSE_KEY_NONE}}</span>
4949
</div>
5050

5151
<!-- Valid License State -->
5252
<div id="license-status-valid" class="license-status-valid" style="display: none;">
5353
<div class="license-info-card">
5454
<div class="license-info-row" style="margin-bottom: 12px;">
55-
<span class="license-info-label">Status:</span>
56-
<span class="license-status-badge">Active</span>
55+
<span class="license-info-label">{{Strings.LICENSE_INFO_STATUS_LABEL}}</span>
56+
<span class="license-status-badge">{{Strings.LICENSE_STATUS_ACTIVE}}</span>
5757
</div>
5858
<div class="license-info-row">
59-
<span class="license-info-label">Licensed to:</span>
59+
<span class="license-info-label">{{Strings.LICENSE_INFO_LICENSED_TO_LABEL}}</span>
6060
<span id="licensed-to-name" class="license-info-value"></span>
6161
</div>
6262
<div class="license-info-row">
63-
<span class="license-info-label">License type:</span>
63+
<span class="license-info-label">{{Strings.LICENSE_INFO_TYPE_LABEL}}</span>
6464
<span id="license-type-name" class="license-info-value"></span>
6565
</div>
6666
<div class="license-info-row">
67-
<span class="license-info-label">Valid until:</span>
67+
<span class="license-info-label">{{Strings.LICENSE_INFO_VALID_UNTIL_LABEL}}</span>
6868
<span id="license-valid-till" class="license-info-value"></span>
6969
</div>
7070
</div>
@@ -73,7 +73,7 @@ <h3 class="license-section-title">
7373
<!-- Error State -->
7474
<div id="license-status-error" class="license-status-error" style="display: none;">
7575
<i class="fa fa-exclamation-triangle"></i>
76-
<span id="license-error-message">Error checking license status</span>
76+
<span id="license-error-message">{{Strings.LICENSE_CHECK_ERROR}}</span>
7777
</div>
7878
</div>
7979

@@ -84,6 +84,6 @@ <h3 class="license-section-title">
8484
</div>
8585

8686
<div class="modal-footer">
87-
<button class="dialog-button btn" data-button-id="close">Close</button>
87+
<button class="dialog-button btn" data-button-id="close">{{Strings.CLOSE}}</button>
8888
</div>
89-
</div>
89+
</div>

src/services/manage-licenses.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ define(function (require, exports, module) {
3232
throw new Error("manage-licenses should have access to KernalModeTrust. Cannot boot without trust ring");
3333
}
3434

35-
const Dialogs = require("widgets/Dialogs"),
35+
const Strings = require("strings"),
36+
Dialogs = require("widgets/Dialogs"),
3637
Mustache = require("thirdparty/mustache/mustache"),
3738
licenseManagementHTML = require("text!./html/license-management.html");
3839

@@ -105,7 +106,7 @@ define(function (require, exports, module) {
105106
const response = await fetchFn(apiURL, {
106107
method: 'POST',
107108
headers: {
108-
'Content-Type': 'application/json',
109+
'Content-Type': 'application/json'
109110
},
110111
body: JSON.stringify({
111112
licenseKey: licenseKey,
@@ -133,10 +134,10 @@ define(function (require, exports, module) {
133134
*/
134135
function _formatDate(timestamp) {
135136
if (!timestamp) {
136-
return 'Never';
137+
return Strings.LICENSE_VALID_NEVER;
137138
}
138139
const date = new Date(timestamp);
139-
return date.toLocaleDateString('en-US', {
140+
return date.toLocaleDateString(Phoenix.getLocale(), {
140141
year: 'numeric',
141142
month: 'long',
142143
day: 'numeric'
@@ -160,16 +161,16 @@ define(function (require, exports, module) {
160161

161162
if (licenseData && licenseData.isValid) {
162163
// Show valid license info
163-
$dialog.find('#licensed-to-name').text(licenseData.licensedToName || 'Unknown');
164-
$dialog.find('#license-type-name').text(licenseData.licenseTypeName || 'Unknown');
164+
$dialog.find('#licensed-to-name').text(licenseData.licensedToName || Strings.LICENSE_STATUS_UNKNOWN);
165+
$dialog.find('#license-type-name').text(licenseData.licenseTypeName || Strings.LICENSE_STATUS_UNKNOWN);
165166
$dialog.find('#license-valid-till').text(_formatDate(licenseData.validTill));
166167
$valid.show();
167168
} else if (licenseData && licenseData.isValid === false) {
168169
// No valid license
169170
$none.show();
170171
} else {
171172
// Error state
172-
$dialog.find('#license-error-message').text('Error checking license status');
173+
$dialog.find('#license-error-message').text(Strings.LICENSE_STATUS_ERROR_CHECK);
173174
$error.show();
174175
}
175176
}
@@ -245,18 +246,18 @@ define(function (require, exports, module) {
245246
const result = await _registerDevice(licenseKey, deviceID, platform, deviceLabel);
246247

247248
if (result.isSuccess) {
248-
_showActivationMessage($dialog, true, result.message || 'License activated successfully!');
249+
_showActivationMessage($dialog, true, result.message || Strings.LICENSE_ACTIVATE_SUCCESS);
249250

250251
// Clear the input field
251252
$dialog.find('#license-key-input').val('');
252253

253254
// Refresh license status
254255
await _loadLicenseStatus($dialog);
255256
} else {
256-
_showActivationMessage($dialog, false, result.errorMessage || 'Failed to activate license');
257+
_showActivationMessage($dialog, false, result.errorMessage || Strings.LICENSE_ACTIVATE_FAIL);
257258
}
258259
} catch (error) {
259-
_showActivationMessage($dialog, false, error.message || 'Failed to activate license');
260+
_showActivationMessage($dialog, false, error.message || Strings.LICENSE_ACTIVATE_FAIL);
260261
} finally {
261262
// Reset button state
262263
$btn.prop('disabled', false);
@@ -266,7 +267,7 @@ define(function (require, exports, module) {
266267
}
267268

268269
async function showManageLicensesDialog() {
269-
const $template = $(Mustache.render(licenseManagementHTML, {}));
270+
const $template = $(Mustache.render(licenseManagementHTML, {Strings}));
270271

271272
Dialogs.showModalDialogUsingTemplate($template);
272273

@@ -279,7 +280,7 @@ define(function (require, exports, module) {
279280
$activateBtn.on('click', async function() {
280281
const licenseKey = $licenseInput.val().trim();
281282
if (!licenseKey) {
282-
_showActivationMessage($dialog, false, 'Please enter a license key');
283+
_showActivationMessage($dialog, false, Strings.LICENSE_ENTER_KEY);
283284
return;
284285
}
285286

0 commit comments

Comments
 (0)