Skip to content

Commit

Permalink
Use two-characater ISO codes for content language
Browse files Browse the repository at this point in the history
  • Loading branch information
kprist committed Jun 25, 2018
1 parent 0fcdf22 commit 1843f78
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 38 deletions.
13 changes: 13 additions & 0 deletions common.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,17 @@ export default {
return a.substring(0,2).toLowerCase() === b.substring(0,2).toLowerCase();
},

translationLanguages: [
'de',
'el',
'en',
'es',
'fr',
'it',
'lt',
'nl',
'pt',
'sr',
],

};
2 changes: 1 addition & 1 deletion components/AddDeck/AddDeck.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class AddDeck extends React.Component {
else {
wrongFields.title = false;
}
if (language === null || language === undefined || language.length !== 5) {
if (language === null || language === undefined || language.length < 2) {
wrongFields.language = true;
everythingIsFine = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { Button, Icon, Segment, Menu,Label,Input, Header,Form,Dropdown} from '
import loadSearchedDecks from '../../../../actions/attachSubdeck/loadSearchedDecks';
import KeywordsInput from '../../../Search/AutocompleteComponents/KeywordsInput';
import UsersInput from '../../../Search/AutocompleteComponents/UsersInput';
import {translationLanguages} from '../../../../configs/general';
import {getLanguageNativeName} from '../../../../common';
import {translationLanguages, getLanguageNativeName} from '../../../../common';

class AttachSearchForm extends React.Component{
constructor(props){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class DeckPropertiesEditor extends React.Component {
isValid = false;
}

if (this.state.language == null || this.state.language.length !== 5) {
if (this.state.language == null || this.state.language.length < 2) {
validationErrors.language = 'Please select a language.';
isValid = false;
}
Expand Down
3 changes: 1 addition & 2 deletions components/Search/SearchPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import TagsInput from './AutocompleteComponents/TagsInput';
import KeywordsInput from './AutocompleteComponents/KeywordsInput';
import loadMoreResults from '../../actions/search/loadMoreResults';
import {FormattedMessage, defineMessages} from 'react-intl';
import {translationLanguages} from '../../configs/general';
import {getLanguageNativeName} from '../../common';
import {translationLanguages, getLanguageNativeName} from '../../common';

let MediaQuery = require ('react-responsive');

Expand Down
3 changes: 1 addition & 2 deletions components/common/LanguageDropdown.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import {FormattedMessage, defineMessages} from 'react-intl';
import {translationLanguages} from '../../configs/general';
import {getLanguageNativeName} from '../../common';
import {translationLanguages, getLanguageNativeName} from '../../common';

/**
* Properties:
Expand Down
14 changes: 0 additions & 14 deletions configs/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,4 @@ export default {
publicRecaptchaKey: '6LdNLyYTAAAAAINDsVZRKG_E3l3Dvpp5sKboR1ET',
loglevel: 'debug',
ssoEnabled: true,

translationLanguages: [
'de-DE',
'el-GR',
'en-GB',
'es-ES',
'fr-FR',
'it-IT',
'lt-LT',
'nl-NL',
'pt-PT',
'sr-RS',
],

};
14 changes: 0 additions & 14 deletions general.js.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,4 @@ export default {
publicRecaptchaKey: '${SERVICE_USER_PUBLIC_RECAPTCHA_KEY}',
loglevel: '${LOGGING_LEVEL}',
ssoEnabled: ${SSO_ENABLED},

translationLanguages: [
'de-DE',
'el-GR',
'en-GB',
'es-ES',
'fr-FR',
'it-IT',
'lt-LT',
'nl-NL',
'pt-PT',
'sr-RS',
],

};
3 changes: 1 addition & 2 deletions stores/TranslationStore.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {BaseStore} from 'fluxible/addons';
import {translationLanguages} from '../configs/general';
import {compareLanguageCodes} from '../common';
import {translationLanguages, compareLanguageCodes} from '../common';

class TranslationStore extends BaseStore {
constructor(dispatcher) {
Expand Down

0 comments on commit 1843f78

Please sign in to comment.