kaobook icon indicating copy to clipboard operation
kaobook copied to clipboard

how to translate the names without modifying origin style?

Open xuehao opened this issue 2 years ago • 0 comments

Now I'm working on this class to support Chinese(or CJK). For the following name, I have to modify the origin style file. Is there any way to rename it outside:

Math

	% Theorems using the 'kaoplain' style
	\theoremstyle{kaoplain}
	\declaretheorem[
		name=定理,    %  hard code
		style=kaoplain,
		%refname={theorem,theorems},
		refname={Theorem,Theorems},
		Refname={Theorem,Theorems},
		numberwithin=section,
		mdframed={
			style=mdfkao,
			backgroundcolor=\kaotheorems@theorembackground,
			%frametitlebackgroundcolor=\@theorembackground,
		},
	]{theorem}
	\declaretheorem[
		name=命题,    % hard code
		%refname={proposition,propositions},
		refname={Proposition,Propositions},
		Refname={Proposition,Propositions},
		sibling=theorem,
		mdframed={
			style=mdfkao,
			backgroundcolor=\kaotheorems@propositionbackground,
			%frametitlebackgroundcolor=\@theorembackground,
		},
	]{proposition}

Bibliography

\@ifpackageloaded{polyglossia}{%
	\IfLanguageName{danish}{%
		\DefineBibliographyStrings{danish}{%
			backrefpage = {citeret på side},
			backrefpages = {citeret på sider},
		}
	}{}
	\IfLanguageName{english}{%
		\DefineBibliographyStrings{english}{%
			% backrefpage = {cited on page},
			% backrefpages = {cited on pages},
			backrefpage = {页码},     % hard code
			backrefpages = {页码},    % hard code
		}
	}{}
	\IfLanguageName{italian}{%
		\DefineBibliographyStrings{italian}{%
			backrefpage = {citato a pag.},
			backrefpages = {citato a pagg.},
		}
	}{}
}

I also try to add chinese option like this, but the result is unexpected:

\@ifpackageloaded{polyglossia}{%
	\IfLanguageName{chinese}{%
		\DefineBibliographyStrings{chinese}{%
			backrefpage = {页码},
			backrefpages = {页码},
		}
	}{}
...
	\@ifpackageloaded{babel}{%
		\IfStringInList{chinese}{\bbl@loaded}{%
		\DefineBibliographyStrings{chinese}{%
			backrefpage = {页码},
			backrefpages = {页码},
		}
		}{}

% in my main.tex
\usepackage[chinese,provide=*]{babel} 
\babelprovide[import,language=Chinese,mapdigits]{chinese} 
\usepackage[style=english]{csquotes}  

屏幕截图 2022-05-26 113257

xuehao avatar May 24 '22 04:05 xuehao