You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am setting up webpack with ttag under development environments.
I found that the way ttag lib handles untranslated entries (i.e. msgstr "") is different from the way babel-plugin-ttag does. In babel-plugin-ttag, it resolves to default locale by default; however, ttag lib just resolves to empty strings.
Since gettext-parser.po() does not provide us ways to filter out untranslated entries, I think we should handle this within ttag lib.
There are 2 ways to handle untranslated entries:
modify the implementation of t, jt, gettext, ngettext in ttag lib to match the implementation of babel-plugin-ttag/resolve.js's no-translation handling.
modify the implementation of addLocale(locale, poData) so that it filters out untranslated entries within poData. This involves changing the logic of transformTranslateObj(translationObj) in utils.js
Personally I prefer method 2 because it is simpler, but method 1 provides more flexibility -- we can implement no-translation warnings / errors similar to babel-plugin-ttag's if we use method 1.
I am happy to send PR for this, but I would like to ask for your opinion on choosing method 1 or method 2.
The text was updated successfully, but these errors were encountered:
I am setting up webpack with ttag under development environments.
I found that the way ttag lib handles untranslated entries (i.e.
msgstr ""
) is different from the way babel-plugin-ttag does. Inbabel-plugin-ttag
, it resolves to default locale by default; however,ttag
lib just resolves to empty strings.Since
gettext-parser.po()
does not provide us ways to filter out untranslated entries, I think we should handle this withinttag
lib.There are 2 ways to handle untranslated entries:
t
,jt
,gettext
,ngettext
in ttag lib to match the implementation of babel-plugin-ttag/resolve.js's no-translation handling.addLocale(locale, poData)
so that it filters out untranslated entries withinpoData
. This involves changing the logic oftransformTranslateObj(translationObj)
inutils.js
Personally I prefer method 2 because it is simpler, but method 1 provides more flexibility -- we can implement no-translation warnings / errors similar to
babel-plugin-ttag
's if we use method 1.I am happy to send PR for this, but I would like to ask for your opinion on choosing method 1 or method 2.
The text was updated successfully, but these errors were encountered: