Skip to content

Commit

Permalink
Make localization context public
Browse files Browse the repository at this point in the history
Enables directly initializing entities from JSON
  • Loading branch information
JP Wright committed Jul 12, 2017
1 parent 139e958 commit 499e08a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Sources/Locale.swift
Expand Up @@ -41,7 +41,16 @@ public class Locale: ImmutableMappable {
}
}

internal class LocalizationContext: MapContext {
/**
The `LocalizationContext` contains meta information about a Space about locales including
information about which locale is the default, and what the fallback locale chain is.
This contextual information is necessary to intiialize `Entry` and `Asset` instances properly so that
the correct data is displayed for the currently selected locale. For instance, if a particular field
for an `Entry` does not have data for the currently selected locale, the SDK will walk the fallback
chain for this field until a non-null value is found, or full chain has been walked.
*/
public class LocalizationContext: MapContext {

// An ordered collection of locales representing the fallback chain.
internal let locales: [LocaleCode: Locale]
Expand Down
3 changes: 2 additions & 1 deletion Sources/Space.swift
Expand Up @@ -24,7 +24,8 @@ public class Space: Resource {
return sys.type
}

internal let localizationContext: LocalizationContext
/// Context for holding information about the fallback chain of locales for the Space.
public let localizationContext: LocalizationContext

// MARK: <ImmutableMappable>

Expand Down

0 comments on commit 499e08a

Please sign in to comment.