Skip to content

Commit

Permalink
Merge pull request #55 from swiss-art-research-net/feature/languageHe…
Browse files Browse the repository at this point in the history
…lper

add language helper
  • Loading branch information
fkraeutli authored May 15, 2024
2 parents eaf291a + 0a27962 commit 7affab2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/main/web/api/services/template/functions/LanguageFunctions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* ResearchSpace
* Copyright (C) 2020, © Trustees of the British Museum
* Copyright (C) 2015-2019, metaphacts GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { getPreferredUserLanguage } from 'platform/api/services/language';

export const LanguageFunctions = {
userPreferredLanguage: function() {
return getPreferredUserLanguage();
}
};
4 changes: 3 additions & 1 deletion src/main/web/api/services/template/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { RdfFunctions } from './RdfFunctions';
import { UriComponentFunctions } from './UriComponentFunctions';
import { NumbersFunctions } from './NumbersFunctions';
import { StringsFunctions } from './StringsFunctions';
import { LanguageFunctions } from './LanguageFunctions';

export const DefaultHelpers = {
...DataContextFunctions,
Expand All @@ -32,7 +33,8 @@ export const DefaultHelpers = {
...RdfFunctions,
...UriComponentFunctions,
...NumbersFunctions,
...StringsFunctions
...StringsFunctions,
...LanguageFunctions
};

export { ContextCapturer, CapturedContext } from './DataContextFunctions';

0 comments on commit 7affab2

Please sign in to comment.