Is there any way to add the langxx code to the template files and fill in xx with the appropriate language code using custom fields when writing the post Forgive me if I am going in the wrong direction here but have have ZERO coding skills

Please fix the punctuation.
Is there any way to add the lang="xx" code to the template files and fill in xx with the appropriate language code using custom fields when writing the post?? Forgive me if I am going in the wrong direction here, but have have ZERO coding skills.