Closed Jeehut closed 2 months ago
Love it, just one change request. We talked recently about prefixing default keys, so let's do that here. Can you prefix all new keys with e.g "TelemetryDeck.Localization."?
@winsmith I just updated this PR to also include the new parameters suggested in https://github.com/TelemetryDeck/docs/pull/85 and the grand rename with the parallel sending of old and new parameters at the same time. For the streamlining of the call APIs (rename of send
to signal
etc.), I will create a separate PR. In that, I will also bump the version num to 2.0.0
.
Note that I greatly simplified the creation of the dictionary. I don't know why exactly you were using a JSONEncoder
and then parsing back with JSONSerialization
, but I'm now just creating a dictionary literal. Probably a historical leftover. See my commit 28065ca1d90f3d2ce251bc2f309a96519c365a34.
Note to myself: Don't forget to also send the new signal name TelemetryDeck.Session.started
.
In Swift,
Locale.current
represents the language and region the app is currently using. When an app is not localized to say German, for example, the identifier will not returnde
for the language even it's the users preferred language.To make it easier for TelemetryDeck users to use a data-driven approach in deciding which languages to localize for next, it is important to add the preferred language of the user though, even if the app doesn't support it. It can also be useful to see just the app language or just the region, without them being clutched together in
locale
as inen_DE
.This PR therefore introduces
region
(the regional part oflocale
),appLanguage
(the language part oflocale
), and the newpreferredLanguage
which is the field that is most useful to make the localization expansion decision.