forked from gnome-keysign/babel-glade
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
29 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,42 @@ | ||
|
||
import os | ||
import unittest | ||
from babelglade.translate import translate_desktop_file, translate_appdata_file | ||
|
||
def relative(test_file): | ||
return os.path.join(os.path.dirname(__file__), test_file) | ||
|
||
|
||
def test_desktop_file(): | ||
translate_desktop_file(relative("test.raw.desktop"), "test.desktop", relative("locale")) | ||
class TranslateTestCase(unittest.TestCase): | ||
|
||
with open("test.desktop") as desktop: | ||
content = desktop.read() | ||
def test_desktop_file(self): | ||
translate_desktop_file(relative("test.raw.desktop"), "test.desktop", relative("locale")) | ||
|
||
assert "Comment=This should be translated." in content | ||
assert "Comment[nl]=Dit moet worden vertaald." in content | ||
assert "Comment[fr]=Cela devrait être traduit." in content | ||
with open("test.desktop") as desktop: | ||
content = desktop.read() | ||
|
||
def test_appdata_xml(): | ||
translate_appdata_file(relative("test.raw.appdata.xml"), "test.appdata.xml", relative("locale")) | ||
assert "Comment=This should be translated." in content | ||
assert "Comment[nl]=Dit moet worden vertaald." in content | ||
assert "Comment[fr]=Cela devrait être traduit." in content | ||
|
||
with open("test.appdata.xml") as desktop: | ||
content = desktop.read() | ||
def test_appdata_xml(self): | ||
translate_appdata_file(relative("test.raw.appdata.xml"), "test.appdata.xml", relative("locale")) | ||
|
||
assert "<p>This should be translated.</p>" in content | ||
assert '<p xml:lang="fr">Cela devrait être traduit.</p>' in content | ||
assert '<p xml:lang="nl">Dit moet worden vertaald.</p>' in content | ||
assert """<p> | ||
with open("test.appdata.xml") as desktop: | ||
content = desktop.read() | ||
|
||
assert "<p>This should be translated.</p>" in content | ||
assert '<p xml:lang="fr">Cela devrait être traduit.</p>' in content | ||
assert '<p xml:lang="nl">Dit moet worden vertaald.</p>' in content | ||
assert """<p> | ||
Multi line | ||
text. | ||
</p>""" in content | ||
assert """<p xml:lang="fr"> | ||
assert """<p xml:lang="fr"> | ||
Texte | ||
multi-ligne. | ||
</p>""" in content | ||
assert """<p xml:lang="nl"> | ||
assert """<p xml:lang="nl"> | ||
Meerregelige | ||
tekst. | ||
</p>""" in content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters