15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This file contains helper functions for getting strings that are included in
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// our DLL for all languages (i.e., does not come from our language DLL).
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// These resource strings are organized such that we can get a localized string
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// by taking the base resource ID and adding a language offset.  For example,
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// to get the resource id for the localized product name in en-US, we take
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// IDS_PRODUCT_NAME_BASE + IDS_L10N_OFFSET_EN_US.
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_INSTALLER_UTIL_L10N_STRING_UTIL_H_
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_INSTALLER_UTIL_L10N_STRING_UTIL_H_
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/string16.h"
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace installer {
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class TranslationDelegate {
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~TranslationDelegate();
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual string16 GetLocalizedString(int installer_string_id) = 0;
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// If we're in Chrome, the installer strings aren't in the binary, but are in
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the localized pak files.  A TranslationDelegate must be provided so we can
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// load these strings.
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)void SetTranslationDelegate(TranslationDelegate* delegate);
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Given a string base id, return the localized version of the string based on
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the system language.  This is used for shortcuts placed on the user's
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// desktop.  The string is retrieved from the TranslationDelegate if one has
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// been set.  Otherwise, the string is read from the binary's string table.
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)std::wstring GetLocalizedString(int base_message_id);
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Given the system language, return a url that points to the localized eula.
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The empty string is returned on failure.
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)std::wstring GetLocalizedEulaResource();
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Returns the language identifier of the translation currently in use.
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)std::wstring GetCurrentTranslation();
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace installer.
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_INSTALLER_UTIL_L10N_STRING_UTIL_H_
49