fix: formula hint translation

This commit is contained in:
zyc9012 2022-05-18 14:35:49 +08:00
parent 06ac237bb3
commit 4d2a308367
2 changed files with 10 additions and 6 deletions

View File

@ -11961,8 +11961,8 @@ export default {
execfunctionSelfErrorResult: execfunctionSelfErrorResult:
"The formula cannot refer to its own cell, which will lead to inaccurate calculation results", "The formula cannot refer to its own cell, which will lead to inaccurate calculation results",
allowRepeatText: "Repeat", allowRepeatText: "Repeatable",
allowOptionText: "Option", allowOptionText: "Optional",
selectCategory: "Or select a category", selectCategory: "Or select a category",
}, },

View File

@ -1,9 +1,11 @@
import { locale } from "@fortune-sheet/core";
import React, { useContext } from "react"; import React, { useContext } from "react";
import WorkbookContext from "../../../context"; import WorkbookContext from "../../../context";
import "./index.css"; import "./index.css";
const FormulaHint: React.FC<React.HTMLAttributes<HTMLDivElement>> = (props) => { const FormulaHint: React.FC<React.HTMLAttributes<HTMLDivElement>> = (props) => {
const { context } = useContext(WorkbookContext); const { context } = useContext(WorkbookContext);
const { formulaMore } = locale(context);
if (!context.functionHint) return null; if (!context.functionHint) return null;
const fn = context.formulaCache.functionlistMap[context.functionHint]; const fn = context.formulaCache.functionlistMap[context.functionHint];
@ -53,7 +55,9 @@ const FormulaHint: React.FC<React.HTMLAttributes<HTMLDivElement>> = (props) => {
</div> </div>
<div className="luckysheet-formula-help-content"> <div className="luckysheet-formula-help-content">
<div className="luckysheet-formula-help-content-example"> <div className="luckysheet-formula-help-content-example">
<div className="luckysheet-arguments-help-section-title"></div> <div className="luckysheet-arguments-help-section-title">
{formulaMore.helpExample}
</div>
<div className="luckysheet-arguments-help-formula"> <div className="luckysheet-arguments-help-formula">
<span className="luckysheet-arguments-help-function-name"> <span className="luckysheet-arguments-help-function-name">
{fn.n} {fn.n}
@ -77,7 +81,7 @@ const FormulaHint: React.FC<React.HTMLAttributes<HTMLDivElement>> = (props) => {
<div className="luckysheet-formula-help-content-detail"> <div className="luckysheet-formula-help-content-detail">
<div className="luckysheet-arguments-help-section"> <div className="luckysheet-arguments-help-section">
<div className="luckysheet-arguments-help-section-title luckysheet-arguments-help-parameter-name"> <div className="luckysheet-arguments-help-section-title luckysheet-arguments-help-parameter-name">
{formulaMore.helpAbstract}
</div> </div>
<span className="luckysheet-arguments-help-parameter-content"> <span className="luckysheet-arguments-help-parameter-content">
{fn.d} {fn.d}
@ -91,12 +95,12 @@ const FormulaHint: React.FC<React.HTMLAttributes<HTMLDivElement>> = (props) => {
{param.name} {param.name}
{param.repeat === "y" && ( {param.repeat === "y" && (
<span className="luckysheet-arguments-help-argument-info"> <span className="luckysheet-arguments-help-argument-info">
...- ...-{formulaMore.allowRepeatText}
</span> </span>
)} )}
{param.require === "o" && ( {param.require === "o" && (
<span className="luckysheet-arguments-help-argument-info"> <span className="luckysheet-arguments-help-argument-info">
-[] -[{formulaMore.allowOptionText}]
</span> </span>
)} )}
</div> </div>