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

fix(baseline): bcd link not localized #10124

Merged
merged 2 commits into from
Dec 4, 2023
Merged
Changes from 1 commit
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
21 changes: 17 additions & 4 deletions client/src/document/baseline-indicator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WebFeatureStatus } from "../../../libs/types/document";
import { useLocale } from "../hooks";
import { BASELINE } from "../telemetry/constants";
import { useGleanClick } from "../telemetry/glean-context";
import { Icon } from "../ui/atoms/icon";
Expand All @@ -10,8 +11,23 @@ const ENGINES = [
{ name: "WebKit", browsers: ["Safari"] },
];

const LOCALIZED_BCD_IDS = {
"en-US": "browser_compatibility",
es: "compatibilidad_con_navegadores",
fr: "compatibilité_des_navigateurs",
ja: "ブラウザーの互換性",
ko: "브라우저_호환성",
"pt-BR": "compatibilidade_com_navegadores",
ru: "совместимость_с_браузерами",
"zh-CN": "浏览器兼容性",
"zh-TW": "瀏覽器相容性",
};

export function BaselineIndicator({ status }: { status: WebFeatureStatus }) {
const gleanClick = useGleanClick();
const locale = useLocale();

const bcdLink = `#${LOCALIZED_BCD_IDS[locale] || LOCALIZED_BCD_IDS["en-US"]}`;

const supported = (browser: string) => {
const version: string | boolean | undefined =
Expand Down Expand Up @@ -90,10 +106,7 @@ export function BaselineIndicator({ status }: { status: WebFeatureStatus }) {
</a>
</li>
<li>
<a
href="#browser_compatibility"
data-glean={BASELINE.LINK_BCD_TABLE}
>
<a href={bcdLink} data-glean={BASELINE.LINK_BCD_TABLE}>
See full compatibility
</a>
</li>
Expand Down