From: Alexander Potashev <aspotashev@gmail.com>
To: KDE russian translation mailing list <kde-russian@lists.kde.ru>
Subject: Re: [kde-russian] Слишком длинные всплывающие подсказки
Date: Sat, 31 Jul 2010 21:55:49 +0400
Message-ID: <AANLkTi=-PLevDpggUdgor2o22eybMem=sV=x_wtH27zo@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=TLnfYYSMW=0PDj4uAFfmOXh=s1zL00wq5PF57@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2847 bytes --]
30 июля 2010 г. 10:41 пользователь Alexander Potashev
<aspotashev@gmail.com> написал:
> Привет,
>
> Наверное многие сталкивались с тем, что на небольших экранах (а иногда
> даже и на большом разрешении) всплывающие подсказки (toolTip) не видны
> полностью, потому что их текст слишком длинный, а переводчики не
> подумали о вставке дополнительных переносов строк ("\n").
>
> Чтобы находить длинные toolTip'ы, можно написать очень простой "sieve"
> для Pology. Он должен будет отсеивать те строки, которые в переводе (а
> может быть и в оригинале -- чтобы можно было сообщить об этом
> разработчикам) имеют длинные строки (например, больше определенного
> количества символов) между символами "\n".
>
> Я мог бы и сам это написать, но хочется, чтобы другие люди тоже
> принимали участие в улучшении качества переводов KDE.
>
> Во вложении к письму
> http://lists.kde.ru/pipermail/kde-russian/2010-July/015197.html
> находится достаточно простой "sieve", который можно взять за основу.
> Конечно, можно вместо него взять один из стандартных "sieve"-ов из Pology.
Набросал "sieve" (см. в прикрепленном файле). Всплывающие подсказки с
текстом в виде HTML не рассматриваются, т.к. ширина подсказки зависит
еще и от размера шрифта и от тегов <br/>, так что там намного сложнее.
В существующем варианте "разрешенная" максимальная длина строки равна
75 символам. Можно обсудить необходимость изменения этой величины.
Теперь ближе к делу: кто хочет заняться исправлением toolTip'ов?
Как запускать проверку:
posieve.py find-wide-tooltips ...путь.../messages
(для этого файл find_wide_tooltips.py нужно положить в каталог pology/sieve/)
С автоматическим открытием строк в Lokalize:
posieve.py find-wide-tooltips ...путь.../messages -slokalize
--
Alexander Potashev
[-- Attachment #2: find_wide_tooltips.py --]
[-- Type: text/x-python, Size: 2104 bytes --]
# -*- coding: UTF-8 -*-
"""
Find tooltip messages containing lines longer than 75 characters.
Sieve options:
- C{lokalize}: open catalogs at matched messages in Lokalize
- C{original}: check "msgid"s instead of "msgstr"s
@author: Alexander Potashev <aspotashev@gmail.com>
@license: GPLv3
Based on sieves from Pology.
"""
from pology import _, n_
from pology.misc.report import report
from pology.misc.msgreport import report_msg_content
from pology.misc.msgreport import report_msg_to_lokalize
import re
def setup_sieve (p):
p.set_desc(_("@info sieve discription",
"Find messages with msgstr[1] == msgstr[2]."
))
p.add_param("lokalize", bool, defval=False,
desc=_("@info sieve parameter discription",
"Open catalogs at matched messages in Lokalize."
))
p.add_param("original", bool, defval=False,
desc=_("@info sieve parameter discription",
"Check \"msgid\"s instead of \"msgstr\"s."
))
def is_tooltip (msg):
return re.search("property .toolTip", "\n".join(msg.auto_comment)) is not None
def max_line_length (str):
return max(map(lambda x: len(x), str.split("\n")))
class Sieve (object):
def __init__ (self, params):
self.p = params
self.nfound = 0
def msg_max_line_length (self, msg):
if (self.p.original):
return max_line_length(msg.msgid)
else:
return max_line_length(msg.msgstr[0])
def process (self, msg, cat):
if (not msg.obsolete and not msg.fuzzy and not msg.untranslated and
is_tooltip(msg) and re.search("<html>", msg.msgstr[0]) is None and
self.msg_max_line_length(msg) > 75):
self.nfound += 1
report_msg_content(msg, cat)
if self.p.lokalize:
report_msg_to_lokalize(msg, cat)
print "-" * 20
def finalize (self):
if self.nfound > 0:
msg = n_("@info:progress",
"Found %(num)d message of translation.",
"Found %(num)d messages of translation.",
num=self.nfound)
report("===== " + msg)
prev parent reply other threads:[~2010-07-31 17:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-30 6:41 Alexander Potashev
2010-07-31 17:55 ` Alexander Potashev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='AANLkTi=-PLevDpggUdgor2o22eybMem=sV=x_wtH27zo@mail.gmail.com' \
--to=aspotashev@gmail.com \
--cc=kde-russian@lists.kde.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
рассылка русскоязычной группы пользователей и разработчиков KDE
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/kde-russian/0 kde-russian/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 kde-russian kde-russian/ http://lore.altlinux.org/kde-russian \
kde-russian@lists.kde.ru
public-inbox-index kde-russian
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.kde-russian
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git