Skip to content

Commit

Permalink
i18n(stages): translate stage names to English
Browse files Browse the repository at this point in the history
- Update stage names in multiple document processing classes
- Translate stage descriptions from Chinese to English
- Improve internationalization of stage naming across document processing pipeline
  • Loading branch information
awwaawwa committed Feb 13, 2025
1 parent 80168e0 commit a4a5e0b
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion babeldoc/document_il/backend/pdf_creater.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class PDFCreater:
stage_name = "创建PDF文件"
stage_name = "Create PDF file"

def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion babeldoc/document_il/frontend/il_creater.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


class ILCreater:
stage_name = "解析PDF并创建中间表示"
stage_name = "Parse PDF and Create Intermediate Representation"

def __init__(self, translation_config: TranslationConfig):
self.progress = None
Expand Down
2 changes: 1 addition & 1 deletion babeldoc/document_il/midend/add_debug_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class AddDebugInformation:
stage_name = "添加DEBUG信息"
stage_name = "Add Debug Information"

def __init__(self, translation_config: TranslationConfig):
self.translation_config = translation_config
Expand Down
2 changes: 1 addition & 1 deletion babeldoc/document_il/midend/il_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def set_output(self, output: str):


class ILTranslator:
stage_name = "翻译段落"
stage_name = "Translate Paragraphs"

def __init__(
self,
Expand Down
2 changes: 1 addition & 1 deletion babeldoc/document_il/midend/layout_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class LayoutParser:
stage_name = "解析页面布局"
stage_name = "Parse Page Layout"

def __init__(self, translation_config: TranslationConfig):
self.translation_config = translation_config
Expand Down
2 changes: 1 addition & 1 deletion babeldoc/document_il/midend/paragraph_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def generate_base58_id(length: int = 5) -> str:


class ParagraphFinder:
stage_name = "解析段落"
stage_name = "Parse Paragraphs"

def __init__(self, translation_config: TranslationConfig):
self.translation_config = translation_config
Expand Down
2 changes: 1 addition & 1 deletion babeldoc/document_il/midend/remove_descent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class RemoveDescent:
stage_name = "移除字体下沉"
stage_name = "Remove Char Descent"

def __init__(self, translation_config: TranslationConfig):
self.translation_config = translation_config
Expand Down
2 changes: 1 addition & 1 deletion babeldoc/document_il/midend/styles_and_formulas.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


class StylesAndFormulas:
stage_name = "解析公式与样式"
stage_name = "Parse Formulas and Styles"

def __init__(self, translation_config: TranslationConfig):
self.translation_config = translation_config
Expand Down
2 changes: 1 addition & 1 deletion babeldoc/document_il/midend/typesetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def render(self) -> [PdfCharacter]:


class Typesetting:
stage_name = "排版"
stage_name = "Typesetting"

def __init__(self, translation_config: TranslationConfig):
self.font_mapper = FontMapper(translation_config)
Expand Down
2 changes: 1 addition & 1 deletion babeldoc/document_il/utils/fontmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class FontMapper:
stage_name = "添加字体"
stage_name = "Add Fonts"

def __init__(self, translation_config: TranslationConfig):
self.font_names = [
Expand Down
11 changes: 11 additions & 0 deletions babeldoc/progress_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ def __init__(
self.loop = loop
if finish_event and not loop:
raise ValueError("finish_event requires a loop")
if self.progress_change_callback:
self.progress_change_callback(
type="stage_summary",
stages=[
{
"name": name,
"percent": 1.0 / len(stages),
}
for name in stages
],
)

def stage_start(self, stage_name: str, total: int):
stage = self.stage[stage_name]
Expand Down

0 comments on commit a4a5e0b

Please sign in to comment.