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
By default, when parsing a file, context string is generated only when necessary when there are multiple identical strings in a file. In this case, the first occurrence of the string doesn't have the context, while others do. However, if a new identical string is inserted at the beginning of the file, it will become the one with no context, while the next one will now suddenly get a context string, making it a new unit, and it's translation will be reset (or reused based on Serge settings). This behavior is especially undesirable when using the feature_branch plugin, where string+context pairs are compared between branches to filter out the pairs that are shared between branches.
To stabilize the output, it makes sense to introduce the use_keys_as_context boolean flag in the job scope, defaulting to NO for backward-compatibility. When set to YES, all string keys reported by the parser will be copied over to the context, unless context was explicitly provided by the parser. This would guarantee in the situations described above that the units are stable even if the strings in the resource file are shuffled around, provided the resource file itself has stable string keys.
The text was updated successfully, but these errors were encountered:
An example would be the master branch having the following resource:
key1=foo
key2=foo
and a feature branch having the following one:
key0=foo
key1=foo
key2=foo
In these two branches strings key1=foo and key0=foo will have no context and will be considered the same by a feature_branch plugin. So what will be exposed for translation is:
master:
'foo' (empty context)
'foo' ('key2' context)
branch:
'foo' ('key1' context)
which is incorrect. Forcing the context would yield proper results:
By default, when parsing a file, context string is generated only when necessary when there are multiple identical strings in a file. In this case, the first occurrence of the string doesn't have the context, while others do. However, if a new identical string is inserted at the beginning of the file, it will become the one with no context, while the next one will now suddenly get a context string, making it a new unit, and it's translation will be reset (or reused based on Serge settings). This behavior is especially undesirable when using the
feature_branch
plugin, where string+context pairs are compared between branches to filter out the pairs that are shared between branches.To stabilize the output, it makes sense to introduce the
use_keys_as_context
boolean flag in the job scope, defaulting toNO
for backward-compatibility. When set toYES
, all string keys reported by the parser will be copied over to the context, unless context was explicitly provided by the parser. This would guarantee in the situations described above that the units are stable even if the strings in the resource file are shuffled around, provided the resource file itself has stable string keys.The text was updated successfully, but these errors were encountered: