Skip to content

Commit

Permalink
feat: Added the counter for non-aligned items in Advanced mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
bookfere authored Apr 7, 2024
2 parents 0ee0f33 + 5644604 commit febb321
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 1 deletion.
8 changes: 7 additions & 1 deletion advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,19 @@ def get_paragraph_count(select_all=True):
return (item_count, char_count)
all_item_count, all_char_count = get_paragraph_count(True)

def non_aligned_paragraphs_count():
return len([p for p in self.table.paragraphs if not p.aligned])

def item_selection_changed():
item_count, char_count = get_paragraph_count(False)
total = '%s/%s' % (item_count, all_item_count)
parts = '%s/%s' % (char_count, all_char_count)
non_aligned_paragraphs = '%s/%s' % ( non_aligned_paragraphs_count(),all_item_count)
paragraph_count.setText(
_('Total items: {}').format(total) + ' · ' +
_('Character count: {}').format(parts))
_('Character count: {}').format(parts)+ ' · ' +
_('Non-aligned paragraphs count: {}').format(non_aligned_paragraphs))

item_selection_changed()
self.table.itemSelectionChanged.connect(item_selection_changed)

Expand Down
13 changes: 13 additions & 0 deletions translations/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 这个脚本用于编译所有的.po文件为对应的.mo文件

$lastLocation = Get-Location

Set-Location $PSScriptRoot

Get-ChildItem -Filter *.po | ForEach-Object {
$poFile = $_.FullName
$moFile = $_.BaseName + '.mo' # Generate the corresponding .mo file name
msgfmt -o $moFile $poFile
}

Set-Location $lastLocation
Binary file modified translations/es.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions translations/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ msgstr "Articulos totales: {}"
msgid "Character count: {}"
msgstr ""

msgid "Non-aligned paragraphs count: {}"
msgstr "Non-aligned paragraphs count:{}"

msgid "Delete"
msgstr "Eliminar"

Expand Down
Binary file modified translations/fr.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions translations/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ msgstr "Items totaux: {}"
msgid "Character count: {}"
msgstr "Nombre de caractères: {}"

msgid "Non-aligned paragraphs count: {}"
msgstr "Nombre total de désalignements:{}"

msgid "Delete"
msgstr "Effacer"

Expand Down
4 changes: 4 additions & 0 deletions translations/message.pot
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ msgstr ""
msgid "Character count: {}"
msgstr ""

#: advanced.py:491 lib/translation.py:233
msgid "Non-aligned paragraphs count: {}"
msgstr ""

#: advanced.py:519 cache.py:92 cache.py:182 components/engine.py:202
#: components/table.py:135
msgid "Delete"
Expand Down
Binary file modified translations/pt.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions translations/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ msgstr "Total de itens: {}"
msgid "Character count: {}"
msgstr "Contador de caracteres: {}"

msgid "Non-aligned paragraphs count: {}"
msgstr "Número total de desalinhamentos:{}"

msgid "Delete"
msgstr "Deletar"

Expand Down
Binary file modified translations/zh_CN.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions translations/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ msgstr "全部条目:{}"
msgid "Character count: {}"
msgstr "字符总数:{}"

msgid "Non-aligned paragraphs count: {}"
msgstr "未对齐总数:{}"

msgid "Delete"
msgstr "删除"

Expand Down
Binary file modified translations/zh_TW.mo
Binary file not shown.
3 changes: 3 additions & 0 deletions translations/zh_TW.po
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ msgstr "項目總計:{}"
msgid "Character count: {}"
msgstr ""

msgid "Non-aligned paragraphs count: {}"
msgstr "未對齊總數:{}"

msgid "Delete"
msgstr "刪除"

Expand Down

0 comments on commit febb321

Please sign in to comment.