Просмотр исходного кода

add defaultMessage in intl.formatMessage

visuddhinanda 2 лет назад
Родитель
Сommit
f09f571f92

+ 1 - 0
dashboard/src/components/admin/relation/CaseSelect.tsx

@@ -24,6 +24,7 @@ const CaseSelectWidget = ({ name = "case", width = "md" }: IWidget) => {
       value: item,
       value: item,
       label: intl.formatMessage({
       label: intl.formatMessage({
         id: `dict.fields.type.${item}.label`,
         id: `dict.fields.type.${item}.label`,
+        defaultMessage: item,
       }),
       }),
     };
     };
   });
   });

+ 1 - 0
dashboard/src/components/admin/relation/GrammarSelect.tsx

@@ -67,6 +67,7 @@ const GrammarSelectWidget = ({
       value: item,
       value: item,
       label: intl.formatMessage({
       label: intl.formatMessage({
         id: `dict.fields.type.${item}.label`,
         id: `dict.fields.type.${item}.label`,
+        defaultMessage: item,
       }),
       }),
     };
     };
   });
   });

+ 1 - 0
dashboard/src/components/dict/Community.tsx

@@ -227,6 +227,7 @@ const CommunityWidget = ({ word }: IWidget) => {
                     gid={strCase}
                     gid={strCase}
                     text={intl.formatMessage({
                     text={intl.formatMessage({
                       id: `dict.fields.type.${strCase}.label`,
                       id: `dict.fields.type.${strCase}.label`,
+                      defaultMessage: strCase,
                     })}
                     })}
                   />
                   />
                 ) : undefined;
                 ) : undefined;

+ 1 - 0
dashboard/src/components/dict/WordCard.tsx

@@ -67,6 +67,7 @@ const WordCardWidget = ({ data }: IWidgetWordCard) => {
                   gid={strCase}
                   gid={strCase}
                   text={intl.formatMessage({
                   text={intl.formatMessage({
                     id: `dict.fields.type.${strCase}.label`,
                     id: `dict.fields.type.${strCase}.label`,
+                    defaultMessage: strCase,
                   })}
                   })}
                 />
                 />
               );
               );

+ 2 - 0
dashboard/src/components/template/Wbw/WbwCase.tsx

@@ -51,6 +51,7 @@ export const caseInDict = (
       noNull.forEach((item, index, arr) => {
       noNull.forEach((item, index, arr) => {
         arr[index] = intl.formatMessage({
         arr[index] = intl.formatMessage({
           id: `dict.fields.type.${item}.short.label`,
           id: `dict.fields.type.${item}.short.label`,
+          defaultMessage: item,
         });
         });
       });
       });
       return { key: item, label: noNull.join(" ") };
       return { key: item, label: noNull.join(" ") };
@@ -150,6 +151,7 @@ const WbwCaseWidget = ({ data, display, onSplit, onChange }: IWidget) => {
               <span key={id} className="case">
               <span key={id} className="case">
                 {intl.formatMessage({
                 {intl.formatMessage({
                   id: `dict.fields.type.${strCase}.short.label`,
                   id: `dict.fields.type.${strCase}.short.label`,
+                  defaultMessage: strCase,
                 })}
                 })}
               </span>
               </span>
             );
             );

+ 4 - 1
dashboard/src/components/template/Wbw/WbwDetailParent2.tsx

@@ -68,7 +68,10 @@ const WbwParent2Widget = ({ data, onChange }: IWidget) => {
   const options = grammar.map((item) => {
   const options = grammar.map((item) => {
     return {
     return {
       value: `.${item}.`,
       value: `.${item}.`,
-      label: intl.formatMessage({ id: `dict.fields.type.${item}.label` }),
+      label: intl.formatMessage({
+        id: `dict.fields.type.${item}.label`,
+        defaultMessage: item,
+      }),
     };
     };
   });
   });
   return (
   return (

+ 1 - 0
dashboard/src/components/template/Wbw/WbwMeaningSelect.tsx

@@ -110,6 +110,7 @@ const WbwMeaningSelectWidget = ({ data, onSelect }: IWidget) => {
               name: wordType,
               name: wordType,
               local: intl.formatMessage({
               local: intl.formatMessage({
                 id: `dict.fields.type.${wordType}.short.label`,
                 id: `dict.fields.type.${wordType}.short.label`,
+                defaultMessage: wordType,
               }),
               }),
               meaning: [],
               meaning: [],
             });
             });

+ 2 - 0
dashboard/src/components/template/Wbw/WbwParent2.tsx

@@ -7,6 +7,7 @@ interface IWidget {
 }
 }
 const WbwParent2Widget = ({ data }: IWidget) => {
 const WbwParent2Widget = ({ data }: IWidget) => {
   const intl = useIntl();
   const intl = useIntl();
+
   return data.grammar2?.value ? (
   return data.grammar2?.value ? (
     data.grammar2.value.trim() !== "" ? (
     data.grammar2.value.trim() !== "" ? (
       <Tooltip title={data.parent2?.value}>
       <Tooltip title={data.parent2?.value}>
@@ -16,6 +17,7 @@ const WbwParent2Widget = ({ data }: IWidget) => {
               "dict.fields.type." +
               "dict.fields.type." +
               data.grammar2.value?.replaceAll(".", "") +
               data.grammar2.value?.replaceAll(".", "") +
               ".short.label",
               ".short.label",
+            defaultMessage: data.grammar2.value?.replaceAll(".", ""),
           })}
           })}
         </Tag>
         </Tag>
       </Tooltip>
       </Tooltip>

+ 1 - 0
dashboard/src/pages/admin/nissaya-ending/list.tsx

@@ -191,6 +191,7 @@ const Widget = () => {
                 <Tag key={id}>
                 <Tag key={id}>
                   {intl.formatMessage({
                   {intl.formatMessage({
                     id: `dict.fields.type.${item}.label`,
                     id: `dict.fields.type.${item}.label`,
+                    defaultMessage: item,
                   })}
                   })}
                 </Tag>
                 </Tag>
               ));
               ));

+ 2 - 0
dashboard/src/pages/admin/relation/list.tsx

@@ -207,6 +207,7 @@ const Widget = () => {
                   <Tag key={id}>
                   <Tag key={id}>
                     {intl.formatMessage({
                     {intl.formatMessage({
                       id: `dict.fields.type.${item}.label`,
                       id: `dict.fields.type.${item}.label`,
+                      defaultMessage: item,
                     })}
                     })}
                   </Tag>
                   </Tag>
                 </Tooltip>
                 </Tooltip>
@@ -232,6 +233,7 @@ const Widget = () => {
                   <Tag key={id}>
                   <Tag key={id}>
                     {intl.formatMessage({
                     {intl.formatMessage({
                       id: `dict.fields.type.${item}.label`,
                       id: `dict.fields.type.${item}.label`,
+                      defaultMessage: item,
                     })}
                     })}
                   </Tag>
                   </Tag>
                 </Tooltip>
                 </Tooltip>