Language¶
-
public class
Language
implements Serializable, Listable¶ Represents a language that may be spoken by users. It may be included as part of the definition of a
Network
or as an attribute of aUser
, for example.
Fields¶
Constructors¶
Language¶
-
public
Language
(long id, String name, int numSpeakers)¶ Create a new
Language
object with the provided propertiesParameters: - id – Unique identifier for the language. The same ID must be used everywhere
- name – Human-readable name of the language. This will be displayed to users. It must also be unique, as it is passed in API calls.
- numSpeakers – The number of Culturemesh users who speak the language
Language¶
-
public
Language
(JSONObject json)¶ Create a new
Language
from the JSON produced by an API call. The JSON must conform to the following format:{ "lang_id": 0, "name": "string", "num_speakers": 0, "added": 0 }
Note that the
added
key is not used and therefore optional.Parameters: - json – JSON representation of the language to create.
Throws: - JSONException – May be thrown for an improperly formatted JSON
Methods¶
getListableName¶
-
public String
getListableName
()¶ Get a descriptive representation of the language suitable for display to user
Returns: Name of the language, abbreviated to be at most Listable.MAX_CHARS
characters long.
getNumUsers¶
-
public long
getNumUsers
()¶ Get the number of users who speak the language
Returns: Number of users who speak the language