Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(footer): gitlab#1342

haitao(lj)8e5216522942
diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml
index c3e3085e..98b40543 100644
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@ -529,7 +529,7 @@ ui:
footer:
build_on: >-
Built on <1> Answer </1>- the open-source software that power Q&A
- communities<br />Made with love © 2022 Answer
+ communities.<br />Made with love © {{cc}}.
upload_img:
name: Change
loading: loading...
diff --git a/ui/src/common/constants.ts b/ui/src/common/constants.ts
index f0a282ba..4992c200 100644
--- a/ui/src/common/constants.ts
+++ b/ui/src/common/constants.ts
@@ -1,3 +1,4 @@
+export const DEFAULT_SITE_NAME = 'Answer';
export const DEFAULT_LANG = 'en_US';
export const CURRENT_LANG_STORAGE_KEY = '_a_lang_';
export const LANG_RESOURCE_STORAGE_KEY = '_a_lang_r_';
diff --git a/ui/src/components/Footer/index.tsx b/ui/src/components/Footer/index.tsx
index d7664e85..65ac6f33 100644
--- a/ui/src/components/Footer/index.tsx
+++ b/ui/src/components/Footer/index.tsx
@@ -2,12 +2,20 @@ import React from 'react';
import { Container } from 'react-bootstrap';
import { Trans } from 'react-i18next';
+import dayjs from 'dayjs';
+
+import { siteInfoStore } from '@/stores';
+import { DEFAULT_SITE_NAME } from '@/common/constants';
+
const Index = () => {
+ const fullYear = dayjs().format('YYYY');
+ const siteName = siteInfoStore.getState().siteInfo.name || DEFAULT_SITE_NAME;
+ const cc = `${fullYear} ${siteName}`;
return (
<footer className="bg-light py-3">
<Container>
<p className="text-center mb-0 fs-14 text-secondary">
- <Trans i18nKey="footer.build_on">
+ <Trans i18nKey="footer.build_on" values={{ cc }}>
Built on
{/* eslint-disable-next-line react/jsx-no-target-blank */}
<a href="https://answer.dev/" target="_blank">
@@ -15,7 +23,7 @@ const Index = () => {
</a>
- the open-source software that powers Q&A communities.
<br />
- Made with love. © 2022 Answer .
+ Made with love. © 2022 Answer.
</Trans>
</p>
</Container>
diff --git a/ui/src/components/Header/index.tsx b/ui/src/components/Header/index.tsx
index 0a841797..3ec00e2c 100644
--- a/ui/src/components/Header/index.tsx
+++ b/ui/src/components/Header/index.tsx
@@ -20,6 +20,7 @@ import {
import { loggedUserInfoStore, siteInfoStore, brandingStore } from '@/stores';
import { logout, useQueryNotificationStatus } from '@/services';
import { RouteAlias } from '@/router/alias';
+import { DEFAULT_SITE_NAME } from '@/common/constants';
import NavItems from './components/NavItems';
@@ -88,7 +89,7 @@ const Header: FC = () => {
/>
</>
) : (
- <span>{siteInfo.name || 'Answer'}</span>
+ <span>{siteInfo.name || DEFAULT_SITE_NAME}</span>
)}
</Navbar.Brand>