1
0
mirror of https://github.com/flarum/core.git synced 2025-08-04 07:27:39 +02:00

fix: caught warnings and missing locale

This commit is contained in:
Sami Mazouz
2024-10-25 10:13:11 +01:00
parent 30c7602814
commit 4715293164
5 changed files with 31 additions and 34 deletions

View File

@@ -14,16 +14,12 @@ export default [
.setting(() => ({ .setting(() => ({
setting: 'flarum-extension-manager.queue_jobs', setting: 'flarum-extension-manager.queue_jobs',
label: app.translator.trans('flarum-extension-manager.admin.settings.queue_jobs'), label: app.translator.trans('flarum-extension-manager.admin.settings.queue_jobs'),
help: m.trust( help: app.translator.trans('flarum-extension-manager.admin.settings.queue_jobs_help', {
extractText( basic_impl_link: <a href="https://discuss.flarum.org/d/28151-database-queue-the-simplest-queue-even-for-shared-hosting" />,
app.translator.trans('flarum-extension-manager.admin.settings.queue_jobs_help', { adv_impl_link: <a href="https://discuss.flarum.org/d/21873-redis-sessions-cache-queues" />,
basic_impl_link: 'https://discuss.flarum.org/d/28151-database-queue-the-simplest-queue-even-for-shared-hosting', php_version: <strong>{app.data.phpVersion}</strong>,
adv_impl_link: 'https://discuss.flarum.org/d/21873-redis-sessions-cache-queues', folder_perms_link: <a href="https://docs.flarum.org/install#folder-ownership" />,
php_version: `<strong>${app.data.phpVersion}</strong>`, }),
folder_perms_link: 'https://docs.flarum.org/install#folder-ownership',
})
)
),
type: 'boolean', type: 'boolean',
disabled: app.data['flarum-extension-manager.using_sync_queue'], disabled: app.data['flarum-extension-manager.using_sync_queue'],
})) }))

View File

@@ -128,6 +128,7 @@ flarum-extension-manager:
party_filter: party_filter:
all: All all: All
premium: Premium premium: Premium
toggle_dropdown_accessible_label: Toggle party filter
queue: queue:
columns: columns:
details: Details details: Details
@@ -169,8 +170,8 @@ flarum-extension-manager:
debug_mode_warning: You are running in debug mode, the extension manager cannot properly install and update local development packages. Please use the command line interface instead for such purposes. debug_mode_warning: You are running in debug mode, the extension manager cannot properly install and update local development packages. Please use the command line interface instead for such purposes.
queue_jobs: Run operations in the background queue queue_jobs: Run operations in the background queue
queue_jobs_help: > queue_jobs_help: >
You can read about a <a href='{basic_impl_link}'>basic queue</a> implementation or a <a href='{adv_impl_link}'>more advanced</a> one. You can read about a <basic_impl_link>basic queue</basic_impl_link> implementation or a <adv_impl_link>more advanced</adv_impl_link> one.
Make sure the PHP version used for the queue is {php_version}. Make sure <a href='{folder_perms_link}'>folder permissions</a> are correctly configured. Make sure the PHP version used for the queue is {php_version}. Make sure <folder_perms_link>folder permissions</folder_perms_link> are correctly configured.
task_retention_days: Task retention days task_retention_days: Task retention days
task_retention_days_help: > task_retention_days_help: >
The number of days to keep completed tasks in the database. Tasks older than this will be deleted. The number of days to keep completed tasks in the database. Tasks older than this will be deleted.

View File

@@ -84,15 +84,10 @@ export default class Translator {
const elements = translation.match(/<(\w+)[^>]*>.*?<\/\1>/g); const elements = translation.match(/<(\w+)[^>]*>.*?<\/\1>/g);
const tags = elements?.map((element) => element.match(/^<(\w+)/)![1]) || []; const tags = elements?.map((element) => element.match(/^<(\w+)/)![1]) || [];
for (const tag of tags) { const autoProvidedTags = this.autoProvidedTags();
if (!parameters[tag]) {
fireDebugWarning(
`Any HTML tags used within translations must have corresponding mithril component parameters.\nCaught in translation: \n\n"""\n${translation}\n"""`,
'',
'v2.0',
'flarum/framework'
);
for (const tag of tags) {
if (!parameters[tag] && autoProvidedTags.includes(tag)) {
parameters[tag] = ({ children }: any) => m(tag, children); parameters[tag] = ({ children }: any) => m(tag, children);
} }
} }
@@ -186,4 +181,8 @@ export default class Translator {
return translation; return translation;
} }
autoProvidedTags(): string[] {
return ['strong', 'code', 'i', 's', 'em', 'sup', 'sub'];
}
} }

View File

@@ -22,20 +22,20 @@ export default class Pagination<CustomAttrs extends IPaginationInterface = IPagi
<nav className="Pagination"> <nav className="Pagination">
<Button <Button
disabled={currentPage === 1} disabled={currentPage === 1}
title={app.translator.trans('core.admin.users.pagination.first_page_button')} title={app.translator.trans('core.lib.pagination.first_button')}
onclick={() => onChange(1)} onclick={() => onChange(1)}
icon="fas fa-step-backward" icon="fas fa-step-backward"
className="Button Button--icon Pagination-first" className="Button Button--icon Pagination-first"
/> />
<Button <Button
disabled={currentPage === 1} disabled={currentPage === 1}
title={app.translator.trans('core.admin.users.pagination.back_button')} title={app.translator.trans('core.lib.pagination.back_button')}
onclick={() => onChange(currentPage - 1)} onclick={() => onChange(currentPage - 1)}
icon="fas fa-chevron-left" icon="fas fa-chevron-left"
className="Button Button--icon Pagination-back" className="Button Button--icon Pagination-back"
/> />
<span className="Pagination-pageNumber"> <span className="Pagination-pageNumber">
{app.translator.trans('core.admin.users.pagination.page_counter', { {app.translator.trans('core.lib.pagination.page_counter', {
// https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/ // https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/
current: ( current: (
<input <input
@@ -43,7 +43,7 @@ export default class Pagination<CustomAttrs extends IPaginationInterface = IPagi
inputmode="numeric" inputmode="numeric"
pattern="[0-9]*" pattern="[0-9]*"
value={loadingPageNumber ?? currentPage} value={loadingPageNumber ?? currentPage}
aria-label={extractText(app.translator.trans('core.admin.users.pagination.go_to_page_textbox_a11y_label'))} aria-label={extractText(app.translator.trans('core.lib.pagination.go_to_page_textbox_a11y_label'))}
autocomplete="off" autocomplete="off"
className="FormControl Pagination-input" className="FormControl Pagination-input"
onchange={(e: InputEvent) => { onchange={(e: InputEvent) => {
@@ -76,14 +76,14 @@ export default class Pagination<CustomAttrs extends IPaginationInterface = IPagi
</span> </span>
<Button <Button
disabled={!moreData} disabled={!moreData}
title={app.translator.trans('core.admin.users.pagination.next_button')} title={app.translator.trans('core.lib.pagination.next_button')}
onclick={() => onChange(currentPage + 1)} onclick={() => onChange(currentPage + 1)}
icon="fas fa-chevron-right" icon="fas fa-chevron-right"
className="Button Button--icon Pagination-next" className="Button Button--icon Pagination-next"
/> />
<Button <Button
disabled={!moreData} disabled={!moreData}
title={app.translator.trans('core.admin.users.pagination.last_page_button')} title={app.translator.trans('core.lib.pagination.last_button')}
onclick={() => onChange(totalPageCount)} onclick={() => onChange(totalPageCount)}
icon="fas fa-step-forward" icon="fas fa-step-forward"
className="Button Button--icon Pagination-last" className="Button Button--icon Pagination-last"

View File

@@ -385,14 +385,6 @@ core:
invalid_column_content: Invalid invalid_column_content: Invalid
pagination:
back_button: Previous page
first_button: Go to first page
go_to_page_textbox_a11y_label: Go directly to page number
last_button: Go to last page
next_button: Next page
page_counter: Page {current} of {total}
search_placeholder: => core.ref.search_users search_placeholder: => core.ref.search_users
title: => core.ref.users title: => core.ref.users
total_users: "Total users: {count}" total_users: "Total users: {count}"
@@ -802,6 +794,15 @@ core:
kilo_text: K kilo_text: K
mega_text: M mega_text: M
# These translations are used in the common pagination component.
pagination:
back_button: Previous page
first_button: Go to first page
go_to_page_textbox_a11y_label: Go directly to page number
last_button: Go to last page
next_button: Next page
page_counter: Page {current} of {total}
# These translations are used by the abstract search component and search modal. # These translations are used by the abstract search component and search modal.
search: search:
gambit_plus_button_a11y_label: Add a positive filter gambit_plus_button_a11y_label: Add a positive filter