Transifex support, js globalisation

This commit is contained in:
Ingo Schommer 2013-10-30 14:21:28 +01:00
parent f66c3c340a
commit aa0f8dbc7b
7 changed files with 72 additions and 25 deletions

14
.tx/config Normal file
View File

@ -0,0 +1,14 @@
[main]
host = https://www.transifex.com
[silverstripe-userforms.master]
file_filter = lang/<lang>.yml
source_file = lang/en.yml
source_lang = en
type = YML
[silverstripe-userforms.master-js]
file_filter = javascript/lang/src/<lang>.js
source_file = javascript/lang/src/en.js
source_lang = en
type = KEYVALUEJSON

View File

@ -55,3 +55,11 @@ testers, clients who use the module and everyone that submits new features.
A big thanks goes out to [Jan Düsedau](http://eformation.de) for drawing
the custom icon set for the form fields.
## Contributing
### Translations
Translations of the natural language strings are managed through a third party translation interface, transifex.com. Newly added strings will be periodically uploaded there for translation, and any new translations will be merged back to the project source code.
Please use [https://www.transifex.com/projects/p/silverstripe-userforms](https://www.transifex.com/projects/p/silverstripe-userforms) to contribute translations, rather than sending pull requests with YAML files.

View File

@ -425,6 +425,7 @@ class UserDefinedForm_Controller extends Page_Controller {
// load the jquery
Requirements::javascript(FRAMEWORK_DIR .'/thirdparty/jquery/jquery.js');
Requirements::javascript('userforms/thirdparty/jquery-validate/jquery.validate.js');
Requirements::add_i18n_javascript('userforms/javascript/lang');
Requirements::javascript('userforms/javascript/UserForm_frontend.js');
if($this->HideFieldLabels) Requirements::javascript('userforms/thirdparty/Placeholders.js/Placeholders.min.js');
}

View File

@ -148,7 +148,7 @@
$("#Fields_fields").sortable('refresh');
},
error: function(e) {
alert(ss.i18n._t('GRIDFIELD.ERRORINTRANSACTION', 'An error occured while fetching data from the server\n Please try again later.'));
alert(ss.i18n._t('GRIDFIELD.ERRORINTRANSACTION'));
}
});
}

20
javascript/lang/en.js Normal file
View File

@ -0,0 +1,20 @@
// This file was generated by GenerateJavaScriptI18nTask from javascript/lang/src/en.js.
// See https://github.com/silverstripe/silverstripe-buildtools for details
if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') {
if(typeof(console) != 'undefined') console.error('Class ss.i18n not defined');
} else {
ss.i18n.addDictionary('en', {
"UserForms.CONFIRM_DELETE_ALL_SUBMISSIONS": "All submissions will be permanently removed. Continue?",
"UserForms.ERROR_CREATING_FIELD": "Error creating field",
"UserForms.ADDING_FIELD": "Adding new field",
"UserForms.ADDED_FIELD": "Added new field",
"UserForms.HIDE_OPTIONS": "Hide options",
"UserForms.SHOW_OPTIONS": "Show options",
"UserForms.ADDING_OPTION": "Adding option",
"UserForms.ADDED_OPTION": "Added option",
"UserForms.ERROR_CREATING_OPTION": "Error creating option",
"UserForms.REMOVED_OPTION": "Removed option",
"UserForms.ADDING_RULE": "Adding rule",
"GRIDFIELD.ERRORINTRANSACTION": "An error occured while fetching data from the server\n Please try again later."
});
}

14
javascript/lang/src/en.js Normal file
View File

@ -0,0 +1,14 @@
{
"UserForms.CONFIRM_DELETE_ALL_SUBMISSIONS": "All submissions will be permanently removed. Continue?",
"UserForms.ERROR_CREATING_FIELD": "Error creating field",
"UserForms.ADDING_FIELD": "Adding new field",
"UserForms.ADDED_FIELD": "Added new field",
"UserForms.HIDE_OPTIONS": "Hide options",
"UserForms.SHOW_OPTIONS": "Show options",
"UserForms.ADDING_OPTION": "Adding option",
"UserForms.ADDED_OPTION": "Added option",
"UserForms.ERROR_CREATING_OPTION": "Error creating option",
"UserForms.REMOVED_OPTION": "Removed option",
"UserForms.ADDING_RULE": "Adding rule",
"GRIDFIELD.ERRORINTRANSACTION": "An error occured while fetching data from the server\n Please try again later."
}

View File

@ -19,6 +19,9 @@ en:
EditableCheckboxGroupField:
PLURALNAME: 'Checkbox Groups'
SINGULARNAME: 'Checkbox Group'
EditableCountryDropdownField:
PLURALNAME: 'Country Dropdowns'
SINGULARNAME: 'Country Dropdown'
EditableDateField:
PLURALNAME: 'Date Fields'
SINGULARNAME: 'Date Field'
@ -105,6 +108,9 @@ en:
SELECTAFIELD: 'Select a Field'
Form:
FIELDISREQUIRED: '%s is required'
GridField:
Filter: Filter
ResetFilter: Reset
SiteTree:
PLURALNAME: Pages
SINGULARNAME: Page
@ -118,53 +124,37 @@ en:
SubmittedFormField:
PLURALNAME: 'Submitted Form Fields'
SINGULARNAME: 'Submitted Form Field'
SubmittedFormReportField.ss:
DELETEALLSUBMISSIONS: 'Delete All Submissions'
DELETESUBMISSION: 'Delete Submission'
EXPORTSUBMISSIONS: 'Export submissions to CSV'
NOSUBMISSIONS: 'No Submissions'
PAGES: Pages
SUBMITTED: 'Submitted at'
UserDefinedForm:
ADDEMAILRECIPIENT: 'Add Email Recipient'
CONFIGURATION: Configuration
DESCRIPTION: 'Adds a customizable form.'
EMAILADDRESS: Email
EMAILBODY: Body
EMAILFROM: From
EMAILRECIPIENTS: 'Email Recipients'
EMAILSUBJECT: 'Email subject'
ENABLELIVEVALIDATION: 'Enable live validation'
EmailFromContent: 'The from address allows you to set who the email comes from. On most servers this will need to be set to an email address on the same domain name as your site. For example on yoursite.com the from address may need to be something@yoursite.com. You can however, set any email address you wish as the reply to address.'
FORM: Form
FORMOPTIONS: 'Form Options'
FORMSUBMISSIONS: 'Form Submissions'
FROMADDRESS: 'Send email from'
HIDEFIELDLABELS: 'Hide field labels'
HIDEFORMDATA: 'Hide form data from email?'
ONCOMPLETELABEL: 'Show on completion'
ORSELECTAFIELDTOUSEASFROM: '.. or select a field to use as reply to address'
ORSELECTAFIELDTOUSEASTO: '.. or select a field to use as the to address'
PLURALNAME: 'User Defined Forms'
RECEIVED: 'Received Submissions'
PLURALNAME: 'Base Pages'
REPLYADDRESS: 'Email for reply to'
SAVESUBMISSIONS: 'Disable Saving Submissions to Server'
SENDEMAILTO: 'Send email to'
SENDPLAIN: 'Send email as plain text? (HTML will be stripped)'
SHOWCLEARFORM: 'Show Clear Form Button'
SINGULARNAME: 'User Defined Form'
SUBMISSIONS: Submissions
SUBMITBUTTON: Submit
TEXTONSUBMIT: 'Text on submit button:'
ADDEMAILRECIPIENT: 'Add Email Recipient'
CONFIGURATION: Configuration
DESCRIPTION: 'Adds a customizable form.'
EMAILRECIPIENTS: 'Email Recipients'
ENABLELIVEVALIDATION: 'Enable live validation'
HIDEFIELDLABELS: 'Hide field labels'
SUBMISSIONS: Submissions
UserDefinedForm_EmailRecipient:
PLURALNAME: 'User Defined Form Email Recipients'
SINGULARNAME: 'User Defined Form Email Recipient'
EditableCountryDropdownField:
PLURALNAME: 'Country Dropdowns'
SINGULARNAME: 'Country Dropdown'
GridField:
Filter: Filter
ResetFilter: Reset
UserFormsGridFieldFilterHeader:
FILTERSUBMISSIONS: 'Filter Submissions..'
WHEREVALUEIS: 'where value is..'