MDL-76331 editor_tiny: Update language strings to use shorter ident

AMOS can only cope with string identifiers with a length < 100
characters. Our tooling for Tiny automatically generates string idents
based on the language string and these can end up longer.

This change modifies our generated idents to be capped at 90 characters.
This commit is contained in:
Andrew Nicols 2022-11-16 21:40:46 +08:00
parent e45f7f691a
commit 205a6c157c
3 changed files with 21 additions and 14 deletions

View File

@ -183,7 +183,7 @@ $string['tiny:horizontal_align'] = 'Horizontal align';
$string['tiny:horizontal_line'] = 'Horizontal line';
$string['tiny:horizontal_space'] = 'Horizontal space';
$string['tiny:id'] = 'ID';
$string['tiny:id_should_start_with_a_letter_followed_only_by_letters_numbers_dashes_dots_colons_or_underscores.'] = 'ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.';
$string['tiny:id_should_start_with_a_letter_followed_only_by_letters_numbers_dashes_dots_colons_or_'] = 'ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.';
$string['tiny:image_is_decorative'] = 'Image is decorative';
$string['tiny:image_list'] = 'Image list';
$string['tiny:image_title'] = 'Image title';
@ -274,7 +274,7 @@ $string['tiny:paste'] = 'Paste';
$string['tiny:paste_as_text'] = 'Paste as text';
$string['tiny:paste_column_after'] = 'Paste column after';
$string['tiny:paste_column_before'] = 'Paste column before';
$string['tiny:paste_is_now_in_plain_text_mode._contents_will_now_be_pasted_as_plain_text_until_you_toggle_this_option_off.'] = 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.';
$string['tiny:paste_is_now_in_plain_text_mode._contents_will_now_be_pasted_as_plain_text_until_you_'] = 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.';
$string['tiny:paste_or_type_a_link'] = 'Paste or type a link';
$string['tiny:paste_row_after'] = 'Paste row after';
$string['tiny:paste_row_before'] = 'Paste row before';
@ -308,7 +308,7 @@ $string['tiny:resize'] = 'Resize';
$string['tiny:restore_last_draft'] = 'Restore last draft';
$string['tiny:rich_text_area'] = 'Rich Text Area';
$string['tiny:rich_text_area._press_alt-0_for_help.'] = 'Rich Text Area. Press ALT-0 for help.';
$string['tiny:rich_text_area._press_alt-f9_for_menu._press_alt-f10_for_toolbar._press_alt-0_for_help'] = 'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help';
$string['tiny:rich_text_area._press_alt-f9_for_menu._press_alt-f10_for_toolbar._press_alt-0_for_hel'] = 'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help';
$string['tiny:ridge'] = 'Ridge';
$string['tiny:right'] = 'Right';
$string['tiny:right_to_left'] = 'Right to left';
@ -355,9 +355,9 @@ $string['tiny:templates'] = 'Templates';
$string['tiny:text'] = 'Text';
$string['tiny:text_color'] = 'Text color';
$string['tiny:text_to_display'] = 'Text to display';
$string['tiny:the_url_you_entered_seems_to_be_an_email_address._do_you_want_to_add_the_required_mailto_prefix'] = 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?';
$string['tiny:the_url_you_entered_seems_to_be_an_external_link._do_you_want_to_add_the_required_http_prefix'] = 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?';
$string['tiny:the_url_you_entered_seems_to_be_an_external_link._do_you_want_to_add_the_required_https_prefix'] = 'The URL you entered seems to be an external link. Do you want to add the required https:// prefix?';
$string['tiny:the_url_you_entered_seems_to_be_an_email_address._do_you_want_to_add_the_required_mai'] = 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?';
$string['tiny:the_url_you_entered_seems_to_be_an_external_link._do_you_want_to_add_the_required_htt'] = 'The URL you entered seems to be an external link. Do you want to add the required http:// prefix?';
$string['tiny:the_url_you_entered_seems_to_be_an_external_link._do_you_want_to_add_the_required_ht1'] = 'The URL you entered seems to be an external link. Do you want to add the required https:// prefix?';
$string['tiny:title'] = 'Title';
$string['tiny:to_open_the_popup_press_shiftenter'] = 'To open the popup, press Shift+Enter';
$string['tiny:tools'] = 'Tools';
@ -388,7 +388,7 @@ $string['tiny:yellow'] = 'Yellow';
$string['tiny:yes'] = 'Yes';
$string['tiny:you_are_using_0'] = 'You are using {0}';
$string['tiny:you_have_unsaved_changes_are_you_sure_you_want_to_navigate_away'] = 'You have unsaved changes are you sure you want to navigate away?';
$string['tiny:your_browser_doesnt_support_direct_access_to_the_clipboard._please_use_the_ctrlxcv_keyboard_shortcuts_instead.'] = 'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.';
$string['tiny:your_browser_doesnt_support_direct_access_to_the_clipboard._please_use_the_ctrlxcv_ke'] = 'Your browser doesn\'t support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.';
$string['tiny:alignment1'] = 'alignment';
$string['tiny:austral_sign'] = 'austral sign';
$string['tiny:cedi_sign'] = 'cedi sign';

View File

@ -154,7 +154,7 @@
"tiny:horizontal_line": "Horizontal line",
"tiny:horizontal_space": "Horizontal space",
"tiny:id": "ID",
"tiny:id_should_start_with_a_letter_followed_only_by_letters_numbers_dashes_dots_colons_or_underscores.": "ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.",
"tiny:id_should_start_with_a_letter_followed_only_by_letters_numbers_dashes_dots_colons_or_": "ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.",
"tiny:image_is_decorative": "Image is decorative",
"tiny:image_list": "Image list",
"tiny:image_title": "Image title",
@ -245,7 +245,7 @@
"tiny:paste_as_text": "Paste as text",
"tiny:paste_column_after": "Paste column after",
"tiny:paste_column_before": "Paste column before",
"tiny:paste_is_now_in_plain_text_mode._contents_will_now_be_pasted_as_plain_text_until_you_toggle_this_option_off.": "Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.",
"tiny:paste_is_now_in_plain_text_mode._contents_will_now_be_pasted_as_plain_text_until_you_": "Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.",
"tiny:paste_or_type_a_link": "Paste or type a link",
"tiny:paste_row_after": "Paste row after",
"tiny:paste_row_before": "Paste row before",
@ -279,7 +279,7 @@
"tiny:restore_last_draft": "Restore last draft",
"tiny:rich_text_area": "Rich Text Area",
"tiny:rich_text_area._press_alt-0_for_help.": "Rich Text Area. Press ALT-0 for help.",
"tiny:rich_text_area._press_alt-f9_for_menu._press_alt-f10_for_toolbar._press_alt-0_for_help": "Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help",
"tiny:rich_text_area._press_alt-f9_for_menu._press_alt-f10_for_toolbar._press_alt-0_for_hel": "Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help",
"tiny:ridge": "Ridge",
"tiny:right": "Right",
"tiny:right_to_left": "Right to left",
@ -326,9 +326,9 @@
"tiny:text": "Text",
"tiny:text_color": "Text color",
"tiny:text_to_display": "Text to display",
"tiny:the_url_you_entered_seems_to_be_an_email_address._do_you_want_to_add_the_required_mailto_prefix": "The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",
"tiny:the_url_you_entered_seems_to_be_an_external_link._do_you_want_to_add_the_required_http_prefix": "The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",
"tiny:the_url_you_entered_seems_to_be_an_external_link._do_you_want_to_add_the_required_https_prefix": "The URL you entered seems to be an external link. Do you want to add the required https:// prefix?",
"tiny:the_url_you_entered_seems_to_be_an_email_address._do_you_want_to_add_the_required_mai": "The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",
"tiny:the_url_you_entered_seems_to_be_an_external_link._do_you_want_to_add_the_required_htt": "The URL you entered seems to be an external link. Do you want to add the required http:// prefix?",
"tiny:the_url_you_entered_seems_to_be_an_external_link._do_you_want_to_add_the_required_ht1": "The URL you entered seems to be an external link. Do you want to add the required https:// prefix?",
"tiny:title": "Title",
"tiny:to_open_the_popup_press_shiftenter": "To open the popup, press Shift+Enter",
"tiny:tools": "Tools",
@ -359,7 +359,7 @@
"tiny:yes": "Yes",
"tiny:you_are_using_0": "You are using {0}",
"tiny:you_have_unsaved_changes_are_you_sure_you_want_to_navigate_away": "You have unsaved changes are you sure you want to navigate away?",
"tiny:your_browser_doesnt_support_direct_access_to_the_clipboard._please_use_the_ctrlxcv_keyboard_shortcuts_instead.": "Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.",
"tiny:your_browser_doesnt_support_direct_access_to_the_clipboard._please_use_the_ctrlxcv_ke": "Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.",
"tiny:alignment1": "alignment",
"tiny:austral_sign": "austral sign",
"tiny:cedi_sign": "cedi sign",

View File

@ -15,6 +15,8 @@
import {readFile, writeFile} from 'fs/promises';
const maxStringIdentifierLength = 90;
const readStringsFromLanguages = async (language) => {
const fileContent = await readFile(`./langs/${language}.js`, 'utf-8');
@ -47,6 +49,11 @@ const getStringMap = (strings) => {
stringKey = `tiny:${stringKey}`;
if (stringKey.length > maxStringIdentifierLength) {
const modifierLength = modifier === 0 ? 0 : `${modifier}`.length;
stringKey = stringKey.slice(0, maxStringIdentifierLength - modifierLength);
}
if (modifier > 0) {
stringKey = `${stringKey}${modifier}`;
}