mirror of
https://github.com/mirego/accent.git
synced 2024-09-11 18:58:14 +03:00
Adds fields to Entry for correct export (#378)
This commit is contained in:
parent
98eb7f93dc
commit
0805e6b385
@ -50,7 +50,10 @@ defmodule Accent.TranslationsRenderer do
|
||||
value: value_map.(translation),
|
||||
comment: translation.file_comment,
|
||||
index: translation.file_index,
|
||||
value_type: translation.value_type
|
||||
value_type: translation.value_type,
|
||||
plural: translation.plural,
|
||||
placeholders: translation.placeholders,
|
||||
locked: translation.locked
|
||||
}
|
||||
end)
|
||||
end
|
||||
|
@ -349,4 +349,53 @@ defmodule AccentTest.ExportController do
|
||||
"""
|
||||
end
|
||||
end
|
||||
|
||||
test "export with plurals and android formatter", %{
|
||||
conn: conn,
|
||||
project: project,
|
||||
revision: revision,
|
||||
language: language
|
||||
} do
|
||||
document = Repo.insert!(%Document{project_id: project.id, path: "test", format: "android_xml"})
|
||||
|
||||
Repo.insert!(%Translation{
|
||||
revision_id: revision.id,
|
||||
key: "days.one",
|
||||
corrected_text: "bar",
|
||||
proposed_text: "bar",
|
||||
plural: true,
|
||||
document_id: document.id,
|
||||
file_index: 2
|
||||
})
|
||||
|
||||
Repo.insert!(%Translation{
|
||||
revision_id: revision.id,
|
||||
key: "days.other",
|
||||
corrected_text: "foo",
|
||||
proposed_text: "foo",
|
||||
plural: true,
|
||||
document_id: document.id,
|
||||
file_index: 1
|
||||
})
|
||||
|
||||
params = %{
|
||||
order_by: "",
|
||||
project_id: project.id,
|
||||
language: language.slug,
|
||||
document_format: document.format,
|
||||
document_path: document.path
|
||||
}
|
||||
|
||||
response = get(conn, export_path(conn, [], params))
|
||||
|
||||
assert response.resp_body == """
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<plurals name="days">
|
||||
<item quantity="other">foo</item>
|
||||
<item quantity="one">bar</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
"""
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user