Skip to content

Commit

Permalink
BGL: use dataclass for BabylonLanguage, and update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Mar 15, 2024
1 parent af0ac72 commit d13f6f3
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions pyglossary/plugins/babylon_bgl/bgl_language.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,39 +113,29 @@
utility confirmed the cp932 and cp950 encodings, I got 100% match.
"""

from dataclasses import dataclass

__all__ = ["BabylonLanguage", "languageByCode"]


# TODO: switch to dataclass
@dataclass
class BabylonLanguage:

"""
Babylon language properties.
name - bab:SourceLanguage, bab:TargetLanguage .gpr tags
(English, French, Japanese)
charset - bab:SourceCharset, bab:TargetCharset .gpr tags
(Latin, Arabic, Cyrillic)
encoding - Windows code page
(cp1250, cp1251, cp1252)
code - value of the type 3, code in .bgl file
name: bab:SourceLanguage, bab:TargetLanguage .gpr tags (English, French, Japanese)
charset: bab:SourceCharset, bab:TargetCharset .gpr tags (Latin, Arabic, Cyrillic)
encoding: Windows code page (cp1250, cp1251, cp1252)
code: value of the type 3, code in .bgl file
"""

def __init__( # noqa: PLR0913
self,
name: str,
charset: str,
encoding: str,
code: int,
code2: str = "",
name2: str = "",
) -> None:
self.name = name
self.name2 = name2
self.charset = charset
self.encoding = encoding
self.code = code
self.code2 = code2
name: str
charset: str
encoding: str
code: int
code2: str = ""
name2: str = ""


languages = (
Expand Down

0 comments on commit d13f6f3

Please sign in to comment.