/*
* Copyright 2015 Anyware Services
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This model is the model for local languages.
*/
Ext.define('Ametys.cms.language.Language', {
extend: 'Ext.data.Model',
fields: [
{ name: 'name', type: 'string'},
{ name: 'label', type: 'string' },
{ name: 'iconSmall', type: 'string' },
{ name: 'iconMedium', type: 'string' },
{ name: 'iconLarge', type: 'string' },
{
name: 'icon',
type: 'string',
depends: ['iconSmall'],
calculate: function (data) {
return Ametys.CONTEXT_PATH + data.iconSmall
}
},
{
name: 'fulllabel',
type: 'string',
depends: ['name', 'label'],
calculate: function (data) {
return data.label + " (" + data.name + ")"
}
}
],
/**
* Get the language's name as such as 'fr', 'en', ...
* @return the language code
*/
getName: function ()
{
return this.data.name;
},
/**
* Get the language label
* @return the label
*/
getLabel: function ()
{
return this.data.label;
},
/**
* Get the language's icon in 16x16 pixels
* @return the 16x16 icon
*/
getIcon: function ()
{
return this.data.icon;
}
});