OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/chrome/browser/ui/util/i18n_string.h" | 5 #import "ios/chrome/browser/ui/util/i18n_string.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 | 10 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." |
| 13 #endif |
| 14 |
11 NSString* AdjustStringForLocaleDirection(NSString* text) { | 15 NSString* AdjustStringForLocaleDirection(NSString* text) { |
12 base::string16 converted_text = base::SysNSStringToUTF16(text); | 16 base::string16 converted_text = base::SysNSStringToUTF16(text); |
13 bool has_changed = | 17 bool has_changed = |
14 base::i18n::AdjustStringForLocaleDirection(&converted_text); | 18 base::i18n::AdjustStringForLocaleDirection(&converted_text); |
15 if (has_changed) { | 19 if (has_changed) { |
16 return base::SysUTF16ToNSString(converted_text); | 20 return base::SysUTF16ToNSString(converted_text); |
17 } | 21 } |
18 return [[text copy] autorelease]; | 22 return [text copy]; |
19 } | 23 } |
OLD | NEW |