GIDSignInStrings.m 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import "GoogleSignIn/Sources/GIDSignInStrings.h"
  15. #import "GoogleSignIn/Sources/NSBundle+GID3PAdditions.h"
  16. NS_ASSUME_NONNULL_BEGIN
  17. // The table name for localized strings (i.e. file name before .strings suffix).
  18. static NSString * const kStringsTableName = @"GoogleSignIn";
  19. #pragma mark - Button Text Constants
  20. // Button texts used as both keys in localized strings files and default values.
  21. static NSString *const kStandardButtonText = @"Sign in";
  22. static NSString *const kWideButtonText = @"Sign in with Google";
  23. @implementation GIDSignInStrings
  24. + (nullable NSString *)localizedStringForKey:(NSString *)key text:(NSString *)text {
  25. NSBundle *frameworkBundle = [NSBundle gid_frameworkBundle];
  26. return [frameworkBundle localizedStringForKey:key value:text table:kStringsTableName];
  27. }
  28. + (nullable NSString *)signInString {
  29. return [self localizedStringForKey:kStandardButtonText text:kStandardButtonText];
  30. }
  31. + (nullable NSString *)signInWithGoogleString {
  32. return [self localizedStringForKey:kWideButtonText text:kWideButtonText];
  33. }
  34. @end
  35. NS_ASSUME_NONNULL_END