xref: /haiku/src/apps/haikudepot/packagemodel/Language.cpp (revision 4c07199d8201fcf267e90be0d24b76799d03cea6)
1 /*
2  * Copyright 2013-2014, Stephan Aßmus <superstippi@gmx.de>.
3  * Copyright 2013, Rene Gollent <rene@gollent.com>.
4  * Copyright 2016-2023, 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.Code()),
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