String Catalog stops updating upon changing source code

If you add a new string in your app (for example String(localized: "contact_support_message", defaultValue: "Please contact support")), then later you change that default value and rebuild, the string catalog updates to match as expected.

But once that string is translated, changing the default value in code and rebuilding does not update the catalog. You seemingly have to go manually change the default value for English in the catalog to match the code (which marks the translation as Needs Review).

Is there a better way? Or is there a way to determine what strings have default values in code that do not match the catalog values to see if any were missed as wording was tweaked over time?

Answered by Developer Tools Engineer in 874421022

But once that string is translated

If by this you mean that it has translations in other languages, then Xcode is expected to update the value and mark translations as needing review automatically.

But if the source string itself is already marked as translated in the xcstrings file, then you are already in a conflicted state where there is a value in code and also a source value in the xcstrings. In that case, it is expected because Xcode will never change the value of a source string that is marked as translated in the source language. It is only allowed to do so if the state is new.

When such a string with a default value from code first appears in the String Catalog, it will have a state of new. The String Catalog Editor then prevents editing this string from the Catalog because the code defined the value and we don't want conflicting state.

But perhaps in your case something or someone went into the JSON and flipped it to translated. In that case, this is expected behavior due to invalid configuration.

Thanks for the post. It seems like you have not received any replies. I think I have a suggestions for you to get people to see the issue you encountering by providing a little project sample.

I am not aware of any localization issues at this time. So once that string is translated, changing the default value in code and rebuilding does not update the catalog? Or is there a way to determine what strings have default values in code that do not match the catalog values to see if any were missed as wording was tweaked over time?

It’s been a long time since I use that, when I was using it I did periodically export my localization files using Xcode's Editor > Export for Localization.... This created an XLIFF file that I can diff against previous versions to spot discrepancies between default values in code and your localization files.

Now, I think many developers are experts in localization and they can provide you great suggestions but I think that if you provide a little focused sample that shows in the most minimal project the issue, will help engineers give you an idea here.

Albert Pascual
  Worldwide Developer Relations.

But once that string is translated

If by this you mean that it has translations in other languages, then Xcode is expected to update the value and mark translations as needing review automatically.

But if the source string itself is already marked as translated in the xcstrings file, then you are already in a conflicted state where there is a value in code and also a source value in the xcstrings. In that case, it is expected because Xcode will never change the value of a source string that is marked as translated in the source language. It is only allowed to do so if the state is new.

When such a string with a default value from code first appears in the String Catalog, it will have a state of new. The String Catalog Editor then prevents editing this string from the Catalog because the code defined the value and we don't want conflicting state.

But perhaps in your case something or someone went into the JSON and flipped it to translated. In that case, this is expected behavior due to invalid configuration.

String Catalog stops updating upon changing source code
 
 
Q