Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added some new strings and fixed an ambiguity for Italian language #751

Open
wants to merge 3 commits into
base: 7.x-1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions locale/it.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
{
"Add Picture": "Aggiungi immagine",
"Browse": "Sfoglia",
"Cancel": "Cancella",
"Cancel": "Annulla",
"Category": "Categoria",
"Confirm": "Conferma",
"Confirm password": "Conferma password",
"Content": "Contenuto",
"Content List": "Lista dei contenuti",
"Create Content": "Crea nuovo contenuto",
"Confirm e-mail address": "Conferma indirizzo e-mail",
"Content List": "Lista dei contenuti",
"Create new account": "Crea un nuovo account",
"Current password": "Password attuale",
"Dashboard": "Cruscotto",
"Day": "Giorno",
"Delete": "Elimina",
"Edit": "Edita",
"E-mail address": "Indirizzo email",
"E-mail new password": "Spedisci via email la nuova password",
"Enter your current password to change the E-mail address or Password.": "Inserisci la tua password attuale per modificare l'indirizzo email o la password.",
"From": "Da",
"Getting Started Guide": "Guida introduttiva",
"History": "Storico",
"Hour": "Ora",
"Logging out": "In uscita",
"Login": "Accedi",
"Logout": "Esci",
"Member since": "Membro da",
"My account": "Il mio profilo",
"Message": "Messaggio",
"Minute": "Minuti",
"Month": "Mese",
"My Account": "Il mio profilo",
"Not Found": "Non trovato",
"OK": "OK",
"Password": "Password",
Expand All @@ -32,19 +41,29 @@
"Registration complete, check your e-mail inbox to verify the account.": "Registrazione completata, controlla la tua casella email per la successiva verifica del tuo account.",
"Registration complete, waiting for administrator approval.": "Registrazione completata, attendi l'approvazione dell'amministratore del sito.",
"Request new password": "Richiedi una nuova password",
"Results": "Risultati",
"Save": "Salva",
"Send message": "Invia messaggio",
"Send yourself a copy?": "Invia una copia a te stesso.",
"Sorry, the page you requested was not found.": "Spiacente, la pagina richiesta non è stata trovata.",
"Spaces are allowed; punctuation is not allowed except for periods, hyphens, apostrophes, and underscores": "Sono ammessi i caratteri di spazio, punto, apostrofo, trattino, underscore (trattino basso)",
"Spaces are allowed; punctuation is not allowed except for periods, hyphens, apostrophes, and underscores.": "Sono ammessi i caratteri di spazio, punto, apostrofo, trattino, underscore (trattino basso)",
"Subject": "Oggetto",
"Support": "Supporto",
"Take Photo": "Scatta",
"Taxonomy": "Tassonomia",
"The open source application development kit for Drupal!": "Il kit open source per lo sviluppo di applicazioni per Drupal!",
"The Username or e-mail address field is required": "Il nome utente oppure l'indirizzo email sono obbligatori",
"Title": "Titolo",
"To": "A",
"To change the current user password, enter the new password in both fields.": "Per modificare la password attuale, inserire quella nuova in ambedue i campi.",
"Username": "Nome utente",
"Username or e-mail address": "Nome utente od indirizzo email",
"Users": "Utenti",
"View": "Vista",
"Vocabularies": "Vocabolari",
"Year": "Anno",
"Your e-mail address": "Il tuo indirizzo e-mail",
"Your name": "Il tuo nome",
"Welcome to DrupalGap": "Benvenuti in DrupalGap",
"Wrong username or password": "Nome utente o password errati"
}
6 changes: 5 additions & 1 deletion src/includes/form.elements.inc.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function _drupalgap_form_render_element(form, element) {

// Grab the language.
var language = language_default();

// We'll assume the element has no items (e.g. title, nid, vid, etc), unless
// we determine later that this element is a field, then it'll have items.
var items = false;
Expand Down Expand Up @@ -346,6 +346,10 @@ function _drupalgap_form_render_element(form, element) {
delta,
element
]);
// hook above may change item.value (see date.js), so put again in variables
if (typeof item.value !== 'undefined') {
variables.attributes.value = item.value;
}
// @TODO - sometimes an item gets merged without a type here, why?
// @UPDATE - did the recursive extend fix this?
item = $.extend(true, item, items[delta]);
Expand Down
5 changes: 5 additions & 0 deletions src/includes/form.inc.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,11 @@ function drupalgap_form_load(form_id) {
// figure out how to handle the 'add another
// item' feature.
}

language = language_default();
if (!form.elements[name][language])
if (form.elements[name].und) { language = 'und'; }

// Initialize the item collections language code if it hasn't been.
if (!form.elements[name][language]) {
form.elements[name][language] = {};
Expand Down
21 changes: 19 additions & 2 deletions src/includes/form.submission.inc.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,24 @@ function _drupalgap_form_submit(form_id) {
*/
function _drupalgap_form_validate(form, form_state) {
try {
var lng;
for (var name in form.elements) {
if (!form.elements.hasOwnProperty(name)) { continue; }
var element = form.elements[name];
if (name == 'submit') { continue; }
if (element.required) {
var valid = true;
var value = null;

if (element.und) {
lng = 'und'
}
else {
lng = language_default();
}

if (element.is_field) {
value = form_state.values[name][language_default()][0];
value = form_state.values[name][lng /*language_default()*/][0];
}
else { value = form_state.values[name]; }
// Check for empty values.
Expand Down Expand Up @@ -173,13 +182,21 @@ function _drupalgap_form_validate(form, form_state) {
*/
function drupalgap_form_state_values_assemble(form) {
try {
var lng = language_default();
var lng; // = language_default();
var form_state = { values: {} };
for (var name in form.elements) {
if (!form.elements.hasOwnProperty(name)) { continue; }
var element = form.elements[name];
if (name == 'submit') { continue; } // Always skip the form 'submit'.
var id = null;

if (element.und) {
lng = 'und'
}
else {
lng = language_default();
}

if (element.is_field) {
form_state.values[name] = {};
form_state.values[name][lng] = {};
Expand Down
7 changes: 7 additions & 0 deletions src/modules/entity/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,13 @@ function drupalgap_entity_build_from_form_state(form, form_state) {
if (!function_exists(hook)) { hook = false; }
}

if (form.elements[name].und) {
language = 'und'
}
else {
language = language_default();
}

// Retrieve the potential key for the element, if we don't get one
// then it is a flat field that should be attached as a property to the
// entity. Otherwise attach the key and value to the entity.
Expand Down
1 change: 1 addition & 0 deletions src/modules/field/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ function drupalgap_field_info_instances_add_to_form(entity_type, bundle,
required: field.required,
description: field.description
};

var default_value = field.default_value;
var cardinality = parseInt(field_info.cardinality);
if (cardinality == -1) {
Expand Down