ESTextHalfYearLocalizer Class Reference
| Inherits from | NSObject |
| Conforms to | ESHalfYearLocalizer ESStringLocalizer |
| Declared in | ESTextHalfYearLocalizer.h ESTextHalfYearLocalizer.m |
Overview
A half year localizer that gets format strings from a given text localizer. Typically, the source is NSLocalizedString() macro.
Tasks
Other Methods
-
– init -
– initWithStringLocalizer:firstHalfYearKey:secondHalfYearKey:yearMode: -
halfYearLocalizerproperty
Other Methods
Instance Methods
formatForFirstHalfYear
Format for the first half of the year. Only year should be parametrized.
- (NSString *)formatForFirstHalfYearDiscussion
@“%@ 年 上半期” –> @“2014 年 上半期”
@“H1 ‘%@” –> @“H1 '14”
Symbols are not escaped. They should be escaped manually prior to using in sqlite queries.
A string constant is formed by enclosing the string in single quotes (‘). A single quote within the string can be encoded by putting two single quotes in a row - as in Pascal. C-style escapes using the backslash character are not supported because they are not standard SQL. https://www.sqlite.org/lang_expr.html
Declared In
ESHalfYearLocalizer.hformatForSecondHalfYear
Format for the second half of the year. Only year should be parametrized.
- (NSString *)formatForSecondHalfYearDiscussion
@“%@ 年 下半期” –> @“2014 年 下半期”
@“H2 ‘%@” –> @“H2 '14”
Symbols are not escaped. They should be escaped manually prior to using in sqlite queries.
A string constant is formed by enclosing the string in single quotes (‘). A single quote within the string can be encoded by putting two single quotes in a row - as in Pascal. C-style escapes using the backslash character are not supported because they are not standard SQL. https://www.sqlite.org/lang_expr.html
Declared In
ESHalfYearLocalizer.hinit
Unsupported initializer. Throws an exception.
- (instancetype)initReturn Value
nil if asserts are disabled.
Declared In
ESTextHalfYearLocalizer.hinitWithStringLocalizer:firstHalfYearKey:secondHalfYearKey:yearMode:
A designated initializer
- (instancetype)initWithStringLocalizer:(id<ESStringLocalizer>)localizer firstHalfYearKey:(NSString *)firstHalfKey secondHalfYearKey:(NSString *)secondHalfKey yearMode:(ESYearMode)yearModeParameters
- localizer
A key-value storage for localized strings.
- firstHalfKey
a key for the localized first half year format.
- secondHalfKey
a key for the localized second half year format.
- yearMode
ESYearModeShort or ESYearModeLong
Return Value
A properly initialized ESTextHalfYearLocalizer object.
Declared In
ESTextHalfYearLocalizer.hlocalizedStringForKey:
A method to return the localized string for a given key.
- (NSString *)localizedStringForKey:(NSString *)keyParameters
- key_
A localization key. In most cases it is a key in the “*.strings” file.
Return Value
A localized string that will be displayed to the user.
Declared In
ESStringLocalizer.hshouldTruncateYear
A boolean value for [ESHalfYearLocalizer yearTruncationMode]
- (BOOL)shouldTruncateYearDiscussion
@return “YES” if [ESHalfYearLocalizer yearTruncationMode] is “short”. “NO” if [ESHalfYearLocalizer yearTruncationMode] is “long”.
Throws an exception for anything else.
Declared In
ESHalfYearLocalizer.h