2 /* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
10 #include "LocalAccessible.h"
11 #include "nsCocoaUtils.h"
12 #include "mozilla/a11y/PDocAccessible.h"
19 * Get a localized string from the a11y string bundle.
20 * Return nil if not found.
22 NSString* LocalizedString(const nsString& aString) {
25 Accessible::TranslateString(aString, text);
27 return text.IsEmpty() ? nil : nsCocoaUtils::ToNSString(text);
30 NSString* GetAccAttr(mozAccessible* aNativeAccessible, nsAtom* aAttrName) {
32 Accessible* acc = [aNativeAccessible geckoAccessible];
33 RefPtr<AccAttributes> attributes = acc->Attributes();
39 attributes->GetAttribute(aAttrName, result);
41 if (!result.IsEmpty()) {
42 return nsCocoaUtils::ToNSString(result);