-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tradução para os campos de busca avançada
- Loading branch information
1 parent
612a32f
commit a068eaf
Showing
10 changed files
with
129 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"all": "All fields", | ||
"title_text": "Title", | ||
"publicationDate": "Year", | ||
"author.name": "Autor", | ||
"language": "Language", | ||
"type": "Type", | ||
"orgunit.name": "Institution", | ||
"keyword_text": "Keyword", | ||
"name_text": "Name", | ||
"status": "Status", | ||
"leader.name": "Leader", | ||
"member.name": "Member", | ||
"country": "Country", | ||
"state": "State", | ||
"city": "City", | ||
"issn": "ISSN", | ||
"issnl": "ISSN-L", | ||
"qualis": "Qualis", | ||
"espacenetTitle_text": "Title", | ||
"inventor.name": "Inventor", | ||
"depositDate": "Deposit year", | ||
"kindCode": "Kind Code", | ||
"countryCode": "Country code", | ||
"lattesId": "Lattes", | ||
"orcid": "Orcid", | ||
"releaseYear": "Release year", | ||
"registrationCountry": "Registration country", | ||
"platform": "Platform" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"all": "Todos os campos", | ||
"title_text": "Título", | ||
"publicationDate": "Ano", | ||
"author.name": "Autor", | ||
"language": "Idioma", | ||
"type": "Tipo", | ||
"orgunit.name": "Organização", | ||
"keyword_text": "Palavra-chave", | ||
"name_text": "Nome", | ||
"status": "Status", | ||
"leader.name": "Líder", | ||
"member.name": "Membro", | ||
"country": "País", | ||
"state": "Estado", | ||
"city": "Cidade", | ||
"issn": "ISSN", | ||
"issnl": "ISSN-L", | ||
"qualis": "Qualis", | ||
"espacenetTitle_text": "Título", | ||
"inventor.name": "Inventor", | ||
"depositDate": "Ano de depóstito", | ||
"kindCode": "Tipo", | ||
"countryCode": "Código do país", | ||
"lattesId": "Lattes", | ||
"orcid": "Orcid", | ||
"releaseYear": "Ano de lançamento", | ||
"registrationCountry": "País de registro", | ||
"platform": "Plataforma" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
// @ts-ignore | ||
|
||
import en from 'public/locales/en/advanced.json'; | ||
// @ts-ignore | ||
import ptBr from 'public/locales/pt-BR/advanced.json'; | ||
|
||
export function findPropertyByValue(value: string) { | ||
for (const property in ptBr) { | ||
//@ts-ignore | ||
if (ptBr[property] === value) { | ||
return property; | ||
} | ||
} | ||
for (const property in en) { | ||
//@ts-ignore | ||
if (en[property] === value) { | ||
return property; | ||
} | ||
} | ||
return value; | ||
} | ||
|
||
export function untranslatedFieldsNames(fullQuery: string) { | ||
const regex = /\(([^:)]+):/g; // pega os nomes dos campos, palavra entre '(' e ':'. | ||
|
||
const names = []; | ||
let name; | ||
while ((name = regex.exec(fullQuery))) { | ||
names.push(name[1]); | ||
} | ||
|
||
const map = new Map(); | ||
names.forEach((name) => { | ||
console.log('name', name); | ||
const untranslated = findPropertyByValue(name); | ||
console.log('untranslated', untranslated); | ||
map.set(name, untranslated); | ||
}); | ||
|
||
for (const [key, value] of map) { | ||
fullQuery = fullQuery.replaceAll(key, value); | ||
} | ||
console.log('fullQuery', fullQuery); | ||
return fullQuery; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters