Skip to content
Open
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
6 changes: 4 additions & 2 deletions packages/angular/src/lib/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ import {
getTranslation,
getBehavior,
type CountryData,
type TranslationCategory,
type TranslationKey,
} from "@firebase-oss/ui-core";

const FIREBASE_UI_STORE = new InjectionToken<FirebaseUIStore>("firebaseui.store");
Expand Down Expand Up @@ -185,9 +187,9 @@ export function injectRecaptchaVerifier(element: () => ElementRef<HTMLDivElement
* @param key - The translation key within the category.
* @returns A computed signal containing the translated string.
*/
export function injectTranslation(category: string, key: string) {
export function injectTranslation<T extends TranslationCategory>(category: T, key: TranslationKey<T>) {
const ui = injectUI();
return computed(() => getTranslation(ui(), category as any, key as any));
return computed(() => getTranslation(ui(), category, key));
}

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import {
} from "@firebase-oss/ui-translations";
import { type FirebaseUI } from "./config";

// Re-export types for use in other packages
export type { TranslationCategory, TranslationKey };

/**
* Gets a translated string for a given category and key.
*
Expand Down