Translate Variable

Hello everyone,

i am trying to create new invoice print format, in our item there is is field called City, it should be part of items discretion, but it should be in 2 language English & Arabic.
i called this filed in English successfully like this :
{{ frappe.db.get_value("Item", {"item_code": row.item_code}, "City") }}
and called translation manually
{{frappe.db.get_value('Translation',{'language':'ar','source_name': 'Riyadh'},"target_name")}}
need to change the source name to be Variable?
try with many ways but without success, any Idea?

thank you in advance

Mohammed

Here’s some key code it seems

Here are related tests https://github.com/frappe/frappe/blob/develop/frappe/tests/test_translation.py

My idea is to develop a test that works for your case with the current code?

Then use that test to add method code for your requirement to accept a variable for that field parameter?

Too bad the tests are sparse, so what you might contribute to point the way ahead would help here :slight_smile:

thank you @clarkej for feedback its work with me now :slight_smile: