This is quite a lot to write for every string. As long as we have legacy js code in core and plugins, i’d rather we keep the global __() and n__() available for translations.
Also, are the strings marked with the explicit function names extracted to to .po files? iirc our i18n process searches only for __() strings in the js code (and’ i’m not sure if it even searches the webpack folder, might need to verfy that as well).
that’s exactly why they are not deprecated, but in webpack code its easy to import the function and use it without a lot of typing. ideally, long term we don’t want to have JS code outside of webpack.
thats a good point!, and you are correct, as long as we keep using __ (or N__ etc) we are OK, see
@amirfefer I assume you should double check that tfm.i18n.__(…) works as expected (for extracting strings).
I double checked and tfm.i18n.sprintf(_('') extracts strings to .po,
and __('') works under webpack as well.
however, tfm.i18n.translate('') does not .
Looking on the bright side, we do not use tfm.i18n.translate in legacy code, and under webpack we use __() alias for it, therefore .po files seems to be fine.
So that means that legacy code should continue using the __() functions rather than the tfm.i18n ones?
Please also update Translating - Foreman and Foreman :: Contribute accordingly.