Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ntp: missing translations #1285

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import styles from './Tile.module.css';
import { urlToColor } from '../color.js';
import { DDG_DEFAULT_ICON_SIZE, DDG_FALLBACK_ICON } from '../constants.js';
import { useItemState } from './PragmaticDND.js';
import { useTypedTranslationWith } from '../../types.js';

/**
* @import {Favorite} from '../../../../../types/new-tab'
* @import enStrings from '../../strings.json'
*/

/**
Expand Down Expand Up @@ -133,6 +135,7 @@ export function Placeholder() {
*/
export function PlusIcon({ onClick }) {
const id = useId();
const { t } = useTypedTranslationWith(/** @type {import('../strings.json')} */ ({}));
const { state, ref } = useItemState(`PLACEHOLDER-URL-${id}`, `PLACEHOLDER-ID-${id}`);
return (
<div class={styles.item} ref={ref} data-edge={'closestEdge' in state && state.closestEdge}>
Expand All @@ -147,7 +150,7 @@ export function PlusIcon({ onClick }) {
</svg>
</button>
<div class={styles.text} id={id}>
{'Add Favorite'}
{t('favorites_add')}
</div>
{state.type === 'is-dragging-over' && state.closestEdge ? <div class={styles.dropper} data-edge={state.closestEdge} /> : null}
</div>
Expand Down
4 changes: 4 additions & 0 deletions special-pages/pages/new-tab/app/favorites/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
"favorites_menu_title": {
"title": "Favorites",
"note": "Used as a label in a customization menu"
},
"favorites_add": {
"title": "Add Favorite",
"note": "A button that allows a user to add a new 'favorite' bookmark to their existing list"
}
}
4 changes: 2 additions & 2 deletions special-pages/pages/new-tab/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export async function init(root, messaging, telemetry, baseEnvironment) {
<InitialSetupContext.Provider value={init}>
<TelemetryContext.Provider value={telemetry}>
<SettingsProvider settings={settings}>
<TranslationProvider translationObject={strings} fallback={strings} textLength={environment.textLength}>
<TranslationProvider translationObject={strings} fallback={enStrings} textLength={environment.textLength}>
<WidgetConfigProvider
api={widgetConfigAPI}
widgetConfigs={init.widgetConfigs}
Expand Down Expand Up @@ -174,7 +174,7 @@ function renderComponents(root, environment, settings, strings) {
$INTEGRATION: render(
<EnvironmentProvider debugState={environment.debugState} injectName={environment.injectName} willThrow={environment.willThrow}>
<SettingsProvider settings={settings}>
<TranslationProvider translationObject={strings} fallback={strings} textLength={environment.textLength}>
<TranslationProvider translationObject={strings} fallback={enStrings} textLength={environment.textLength}>
<Components />
</TranslationProvider>
</SettingsProvider>
Expand Down
4 changes: 4 additions & 0 deletions special-pages/pages/new-tab/src/locales/de/new-tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,9 @@
"favorites_menu_title" : {
"title" : "Favoriten",
"note" : "Used as a label in a customization menu"
},
"favorites_add" : {
"title" : "Favorit hinzufügen",
"note" : "A button that allows a user to add a new 'favorite' bookmark to their existing list"
}
}
4 changes: 4 additions & 0 deletions special-pages/pages/new-tab/src/locales/en/new-tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,9 @@
"favorites_menu_title": {
"title": "Favorites",
"note": "Used as a label in a customization menu"
},
"favorites_add": {
"title": "Add Favorite",
"note": "A button that allows a user to add a new 'favorite' bookmark to their existing list"
}
}
4 changes: 4 additions & 0 deletions special-pages/pages/new-tab/src/locales/es/new-tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,9 @@
"favorites_menu_title" : {
"title" : "Favoritos",
"note" : "Used as a label in a customization menu"
},
"favorites_add" : {
"title" : "Añadir favorito",
"note" : "A button that allows a user to add a new 'favorite' bookmark to their existing list"
}
}
4 changes: 4 additions & 0 deletions special-pages/pages/new-tab/src/locales/fr/new-tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,9 @@
"favorites_menu_title" : {
"title" : "Favoris",
"note" : "Used as a label in a customization menu"
},
"favorites_add" : {
"title" : "Ajouter un favori",
"note" : "A button that allows a user to add a new 'favorite' bookmark to their existing list"
}
}
4 changes: 4 additions & 0 deletions special-pages/pages/new-tab/src/locales/nl/new-tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,9 @@
"favorites_menu_title" : {
"title" : "Favorieten",
"note" : "Used as a label in a customization menu"
},
"favorites_add" : {
"title" : "Favoriet toevoegen",
"note" : "A button that allows a user to add a new 'favorite' bookmark to their existing list"
}
}
4 changes: 4 additions & 0 deletions special-pages/pages/new-tab/src/locales/pl/new-tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,9 @@
"favorites_menu_title" : {
"title" : "Ulubione",
"note" : "Used as a label in a customization menu"
},
"favorites_add" : {
"title" : "Dodaj do Ulubionych",
"note" : "A button that allows a user to add a new 'favorite' bookmark to their existing list"
}
}
4 changes: 4 additions & 0 deletions special-pages/pages/new-tab/src/locales/pt/new-tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,9 @@
"favorites_menu_title" : {
"title" : "Favoritos",
"note" : "Used as a label in a customization menu"
},
"favorites_add" : {
"title" : "Adicionar favorito",
"note" : "A button that allows a user to add a new 'favorite' bookmark to their existing list"
}
}
4 changes: 4 additions & 0 deletions special-pages/pages/new-tab/src/locales/ru/new-tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,9 @@
"favorites_menu_title" : {
"title" : "Избранное",
"note" : "Used as a label in a customization menu"
},
"favorites_add" : {
"title" : "Добавить в избранное",
"note" : "A button that allows a user to add a new 'favorite' bookmark to their existing list"
}
}
Loading