Translation:I was in the capital of Italy recently.
There are also other alternate wordings with equivalent meanings — e.g. “I was in the Italian capital recently”, “I was in Rome recently”, etc. — where should the line be drawn? Since the Irish sentence is using a genitive structure which makes the governing word definite, it seems reasonable that the translation should use a similar structure if it’s colloquial in English.
príomhchathair na hIodáile is "the capital of Italy" - the definite article in such genitive phrases goes between the two nouns, not in front of them. (Bunreacht na hÉireann - "the Constitution of Ireland, muintir na Tíre - "the people of the Country", Corn an Domhain - "the World Cup" (the Cup of the World).
As príomhchathair na hIodáile means "the capital of Italy", i (bpríomhchathair na hIodáile) means "in (the capital of Italy)".
Bhí mé sa phríomhchathair - "I was in the capital"
Bhí mé i bpríomhchathair na hIodáile - "I was in the capital of Italy"