xref: /haiku/src/apps/haikudepot/packagemodel/Language.cpp (revision dd2a1e350b303b855a50fd64e6cb55618be1ae6a)
1 /*
2  * Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
3  * Copyright 2013, Rene Gollent <rene@gollent.com>.
4  * Copyright 2016-2024, Andrew Lindesay <apl@lindesay.co.nz>.
5  * All rights reserved. Distributed under the terms of the MIT License.
6  */
7 
8 
9 #include "Language.h"
10 
11 
12 Language::Language(const char* language, const BString& serverName,
13 	bool isPopular)
14 	:
15 	BLanguage(language),
16 	fServerName(serverName),
17 	fIsPopular(isPopular)
18 {
19 }
20 
21 
22 Language::Language(const Language& other)
23 	:
24 	BLanguage(other.ID()),
25 	fServerName(other.fServerName),
26 	fIsPopular(other.fIsPopular)
27 {
28 }
29 
30 
31 status_t
32 Language::GetName(BString& name,
33 const BLanguage* displayLanguage) const
34 {
35 	status_t result = BLanguage::GetName(name, displayLanguage);
36 
37 	if (result == B_OK && (name.IsEmpty() || name == Code()))
38 		name.SetTo(fServerName);
39 
40 	return result;
41 }
42