# The arcane for KDE translation into Serbian.
# Chusslove Illich (Часлав Илић) <caslav.ilic@gmx.net>
# License: GPLv3

environment kde

# ----------------------------------------
# Detect Latin segments outside of allowed contexts.

clearFilters
# No filters (e.g. markup designates allowed contexts).

# Allow original UI references (autoresolved when summit is scattered).
*hook name="sr:checks/naked_latin_origui" on="msgstr"
id="x-latin"
hint="латиница ван дозвољеног контекста"
valid cat="libkunitconversion"

# ----------------------------------------
# Detect markup errors.

clearFilters

# So that markup checker can properly escape &-accelerators:
# - convert hybridized Ekavian-Yekavian text into Ekavian
addFilterHook name="sr:wconv/hitoe" on="pmsgstr"
# - remove naked Latin wrappings
addFilterRegex match="~!(.)(.*?)\1" repl="\2" on="pmsgid,pmsgstr"

# Strict mode means to request valid translation even if the original is not.
# Catalogs must announce markup in the header, using markup type keyword in
# X-Text-Markup field (see markup= parameters in factories below);
# when the hook and catalog markup types do not match, the check is skipped.
# Whether non-default XML entities are defined is checked separately,
# so that checks can be performed separately.

# Markup in KDE4 UI POs.
*hook name="markup/check-kde4-sp~strict=True, entities=None, mkeyw='kde4'" \
      on="msgstr"
id="x-markup-k"
hint="грешка у обележавању"

# Markup in pure Qt UI POs.
*hook name="markup/check-qtrich-sp~\
            strict=True, entities=None, mkeyw='qtrich'" \
      on="msgstr"
id="x-markup-q"
hint="грешка у обележавању"

# Markup in Docbook POs.
*hook name="markup/check-docbook4-sp~\
            strict=True, entities=None, mkeyw='docbook4'" \
      on="msgstr"
id="x-markup-db"
hint="грешка у обележавању"

# Remove local entities which are to be left as-is in the message.
addFilterHook name="remove/remove-ignored-entities-msg" on="msg"

# Entities in UI POs with XML-like markup.
*hook name="markup/check-xmlents-sp~\
            strict=True, \
            entities='sr:trapnakron/trapnakron_ui~', default=True, \
            mkeyw=['kde4', 'qtrich']" \
      on="msgstr"
id="x-entities-uix"
hint="недефинисани ентитет"

# Entities in UI POs with otherwise plain text.
*hook name="markup/check-xmlents-sp~\
            strict=True, \
            entities='sr:trapnakron/trapnakron_ui~', \
            mkeyw=['xmlents']" \
      on="msgstr"
id="x-entities-uit"
hint="недефинисани ентитет"

# Entities in Docbook POs.
*hook name="markup/check-xmlents-sp~\
            strict=True, \
            entities='sr:trapnakron/trapnakron_docbook4~', default=True, \
            mkeyw='docbook4'" \
      on="msgstr"
# Remove entities used as-is in KDE documentation.
addFilterRegex match="&\S+\.e?mail;" on="pmsgid,pmsgstr"
addFilterRegex match="&\S+\.documentation;" on="pmsgid,pmsgstr"
addFilterRegex match="&under(FDL|GPL|\w+License);" on="pmsgid,pmsgstr"
addFilterRegex match="&(FDL|GPL)notice;" on="pmsgid,pmsgstr"
addFilterRegex match="&reporting.bugs;" on="pmsgid,pmsgstr"
addFilterRegex match="&kde-(ftp|http);" on="pmsgid,pmsgstr"
id="x-entities-db"
hint="недефинисани ентитет"

# ----------------------------------------
# Detect problems with UI references.

clearFilters
# No filters (e.g. markup designates references automatically).

# ...in KDE4 UI POs.
*hook name="uiref/check-ui-kde4~\
            uicpathenv='UICATS_KDE4_SR', mkeyw='kde4'" \
      on="msgstr"
id="x-uiref-k"
hint="неуспело разрешавање ниске сучеља"

# ...in KDE documentation POs.
*hook name="uiref/check-ui-docbook4~\
            uicpathenv='UICATS_KDE4_SR', mkeyw='docbook4'" \
      on="msgstr"
id="x-uiref-db"
hint="неуспело разрешавање ниске сучеља"

# ...in other catalogs (e.g. pure Qt UI, desktop files).
*hook name="uiref/check-ui~\
            uicpathenv='UICATS_KDE4_SR', \
            mkeyw=['docbook4', 'kde4'], invmkeyw=True" \
      on="msgstr"
id="x-uiref-o"
hint="неуспело разрешавање ниске сучеља"

# ----------------------------------------
# Check ekavian-yekavian hybridization.

clearFilters
# No filters, so that to_e filter hook does not spew errors,
# and to be faster if run standalone.

*hook name="sr:wconv/validate_dhyb" on="pmsgstr"
id="x-dhyblint"
hint="непознат рефлекс јата (или лош ек-ијек уметак)"

# ----------------------------------------
# Check for inadvertently left embedded differences.

clearFilters

{\{[+-]|[+-]\}}
id="x-ediff-o"
hint="неуклоњене угнежђене разлике у извору"

[\{[+-]|[+-]\}]
id="x-ediff-t"
hint="неуклоњене угнежђене разлике у преводу"

# ----------------------------------------
# Check for appropriate entity variants.

clearFilters

[&\w+-\w*;]i
id="x-entvar-ot"
hint="ентитет мора бити варијанте обичног текста (_ot-)"
valid !comment="\btag:.*(holder|keyword|gui[a-z]+|releaseinfo|\barg\b|contrib)" \
      !after="< *(holder|keyword|gui[a-z]+|releaseinfo|\barg\b|contrib)[^>]*>[^<]*"
valid span="_ot-"

[&\w+-\w*;]i
id="x-entvar-lv"
hint="ентитет мора бити лакше варијанте обележавања (_lv-)"
valid !msgid="< *(firstname|surname|othername)"
valid msgid="< *personname"
valid after="< *(contrib)[^>]*>[^<]*" # на x-entvar-ot
valid span="_lv-"

# ----------------------------------------
# The following rules should be applied on pure text.
clearFilters
include file="puretext.filters"
removeFilter handle="uiref"

# Check spelling.
*hook name="spell/check-spell-sp~" on="msgstr"
# Remove Latin-only words.
# There may also be non-Latin case endings, remove them too.
addFilterRegex match="[a-zđžćčš]+(-\w+)?" on="pmsgid,pmsgstr"
id="x-spell"
hint="непознате или погрешно написане речи"
# Разне транскрипције и измишљотине, прескачемо док нешто не приправимо.
valid cat="timezones4,desktop_l10n,l10n.desktop,kdelibs_colors4"
valid cat="kdelibs4" ctx="unicode block name"
valid cat="kdelibs4" srcref="kcalendarsystem" !srcref="gregorian"
valid cat="kdecalendarsystems" !srcref="gregorian"
valid cat="desktop_kdelibs,kdelibs.desktop" srcref="all_languages.desktop"
valid cat="kdeqt" ctx="QFontDatabase"
valid cat="kfontinst" srcref="Unicode(Blocks|Scripts)\.h"
# Елементи транскрипта.
valid span="^([Аа]ку)$" after="\$\[[^\]]*"
