Skip to content

Commit

Permalink
#10: hxltmdexml, XLIFF2 now reuse generic XML logic (was using old ha…
Browse files Browse the repository at this point in the history
…rdcoded one)
  • Loading branch information
fititnt committed Nov 28, 2021
1 parent 0aff810 commit 1c94cd9
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 23 deletions.
21 changes: 14 additions & 7 deletions bin/hxltmdexml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1365,10 +1365,10 @@ def de_xliff(self):
# that XLIFF 2.x can have the souce and target language
# defined already at <xliff> element

# ontologia_de_xml = \
# self._ontologia.crudum['normam']['XLIFF']['de_xml']
ontologia_de_xml = \
self._ontologia.crudum['normam']['XLIFF']['de_xml']

# return self._de_commune_xml(ontologia_de_xml)
return self._de_commune_xml(ontologia_de_xml)

resultatum_csv = csv.writer(
self.objectvum_archivum,
Expand Down Expand Up @@ -2023,10 +2023,12 @@ class HXLTMOntologia:
>>> ontologia.quid_est_hashtag_circa_conceptum('#rem+rem+i_la+i_lat+is_latn')
False
>>> ontologia.quid_est_hashtag_circa_linguam('#item+conceptum+codicem')
>>> ontologia.quid_est_hashtag_circa_linguam_aut_terminum(
... '#item+conceptum+codicem')
False
>>> ontologia.quid_est_hashtag_circa_linguam('#rem+rem+i_la+i_lat+is_latn')
>>> ontologia.quid_est_hashtag_circa_linguam_aut_terminum(
... '#rem+rem+i_la+i_lat+is_latn')
True
Expand Down Expand Up @@ -2618,7 +2620,7 @@ def quid_est_hashtag_circa_conceptum(
# TODO: make this actually read the cor.hxltm.215.yml. This hardcoded
# part is just a quick fix

if HXLTMOntologia.quid_est_hashtag_circa_linguam(hxl_hashtag):
if HXLTMOntologia.quid_est_hashtag_circa_linguam_aut_terminum(hxl_hashtag):
return False

if hxl_hashtag.find('+conceptum') > -1:
Expand All @@ -2627,7 +2629,7 @@ def quid_est_hashtag_circa_conceptum(
return False

@staticmethod
def quid_est_hashtag_circa_linguam(hxl_hashtag: str) -> bool:
def quid_est_hashtag_circa_linguam_aut_terminum(hxl_hashtag: str) -> bool:
"""Quid est hashtag circa linguam?
_[eng-Latn]
Expand All @@ -2643,6 +2645,11 @@ def quid_est_hashtag_circa_linguam(hxl_hashtag: str) -> bool:
# TODO: make this actually read the cor.hxltm.215.yml. This hardcoded
# part is just a quick fix

if hxl_hashtag.startswith('#item+linguam'):
return True
if hxl_hashtag.startswith('#meta+linguam'):
return True

if hxl_hashtag.startswith('#item+rem+i_'):
return True
if hxl_hashtag.startswith('#meta+rem+i_'):
Expand Down
12 changes: 12 additions & 0 deletions testum/disciplinam-manuale-anglicum.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ hxltmcli --help > "hxltmcli--help_eng-Latn.txt"
# [eng-Latn]_
hxltmdexml --help > "hxltmdexml--help_eng-Latn.txt"

#
# To validate all XMLs
# find . -iname "*.xml" -o -iname "*.tbx" -o -iname "*.xlf" -type f | xargs xmlstarlet val

### TODO: implement XML generic validation as part of the test
# if command -v xmlstarlet; then
# find . -iname "*.xml" -o -iname "*.tbx" -o -iname "*.xlf" -type f | xargs xmlstarlet val
# else
# echo "no XML test validation now"
# fi
### TODO: implement some way to also validate all CSVs on folder

# tag::HXLTM_CSV[]
### I -------------------------------------------------------------------------
# _[eng-Latn]
Expand Down
14 changes: 7 additions & 7 deletions testum/resultatum/csv-3-exemplum.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
en-GB,pt-PT,
UN,ONU,"International organization founded in 1945, its mission and work are guided by the purposes and principles contained in its founding Charter. Its chief administrative officer is the Secretary-General."
United Nations,Organização das Nações Unidas,
IFRC,FICV/CV,
International Federation of Red Cross and Red Crescent Societies ,Federação Internacional das Sociedades da Cruz Vermelha e do Crescente Vermelho,
AI,AI,"non-governmental organisation which draws attention to human rights abuses, campaigns for compliance with international laws and standards, and works to mobilise public opinion to put pressure on governments that let abuse take place"
Amnesty International,Amnistia Internacional,
en-GB,pt-PT,
UN,ONU,"International organization founded in 1945, its mission and work are guided by the purposes and principles contained in its founding Charter. Its chief administrative officer is the Secretary-General."
United Nations,Organização das Nações Unidas,
IFRC,FICV/CV,
International Federation of Red Cross and Red Crescent Societies ,Federação Internacional das Sociedades da Cruz Vermelha e do Crescente Vermelho,
AI,AI,"non-governmental organisation which draws attention to human rights abuses, campaigns for compliance with international laws and standards, and works to mobilise public opinion to put pressure on governments that let abuse take place"
Amnesty International,Amnistia Internacional,
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#item+conceptum+codicem,#item+conceptum+indicem_de_terminum,#meta+conceptum,#item+rem+i_pt+i_por+is_latn,#meta+linguam+i_pt+i_por+is_latn,#item+rem+i_es+i_spa+is_latn,#meta+linguam+i_es+i_spa+is_latn
L10N_ego_summarius,Língua portuguesa (alfabeto latino),Idioma español (Alfabeto latino)
L10N_ego_codicem,por-Latn,spa-Latn
L10N_ego_linguam_nomen,Língua portuguesa,Idioma español
L10N_ego_scriptum_nomen,Alfabeto latino,Alfabeto latino
L10N_ego_patriam_UN_M49_numerum,001,001
L10N_ego_patriam_UN_P_codicem,∅,∅
I18N_testum_salve_mundi_testum_I18N,Olá mundo!,¡Hola mundo!
I18N_إختبار_טעסט_测试_테스트_испытание_I18N,"Teste, 1, 2, 3","Prueba, 1, 2, 3"
I18N_०१२३४५६७८९_〇一二三四五六七八九十百千万亿_-1234_٩٨٧٦٥٤٣٢١٠_零壹贰叁肆伍陆柒捌玖拾佰仟萬億_I18N,"1, 2, 3, 4, 5, 6, 7, 8, 9, 10","1, 2, 3, 4, 5, 6, 7, 8, 9, 10"
L10N_ego_summarius,1,,Língua portuguesa (alfabeto latino),,Idioma español (Alfabeto latino),
L10N_ego_codicem,1,,por-Latn,,spa-Latn,
L10N_ego_linguam_nomen,1,,Língua portuguesa,,Idioma español,
L10N_ego_scriptum_nomen,1,,Alfabeto latino,,Alfabeto latino,
L10N_ego_patriam_UN_M49_numerum,1,,001,,001,
L10N_ego_patriam_UN_P_codicem,1,,∅,,∅,
I18N_testum_salve_mundi_testum_I18N,1,,Olá mundo!,,¡Hola mundo!,
I18N_إختبار_טעסט_测试_테스트_испытание_I18N,1,,"Teste, 1, 2, 3",,"Prueba, 1, 2, 3",
I18N_०१२३४५६७८९_〇一二三四五六七八九十百千万亿_-1234_٩٨٧٦٥٤٣٢١٠_零壹贰叁肆伍陆柒捌玖拾佰仟萬億_I18N,1,,"1, 2, 3, 4, 5, 6, 7, 8, 9, 10",,"1, 2, 3, 4, 5, 6, 7, 8, 9, 10",

0 comments on commit 1c94cd9

Please sign in to comment.