⬇️ Install package: OJS/OMP/OPS 3.5 — or browse all Releases.
A block plugin for Open Journal Systems (OJS), Open Monograph Press (OMP) and Open Preprint Systems (OPS) that renders the language switcher in the sidebar as a list of country flags with each language name, instead of the plain default toggle.
Maintained by OJSBR. Adapted for PKP 3.5 from the original
languageToggleByFlagplugin by Lepidus Tecnologia. See the Credits & authorship section below.
| PKP version | Branch | Plugin release |
|---|---|---|
| OJS/OMP/OPS 3.5.x | stable-3_5_0 (default) |
3.5.0.7 |
Need 3.4 or earlier? Use the original repository: lepidus/languageToggleByFlag.
The default language toggle is a plain list or drop-down of language names. In a multilingual journal, readers who do not read the current interface language have to find their own language in that list; a flag next to each name makes the switcher recognizable at a glance.
- Lists every language enabled for the site or journal, each with its name in that language and, when the plugin ships an image for it, a flag (24 flags). Languages without a flag are listed by name only.
- Switching language keeps the reader on the same page.
- Install via Settings → Website → Plugins → Upload A New Plugin, or extract the folder
into
plugins/blocks/so you getplugins/blocks/languageToggleByFlag/. - Enable Language Toggle By Flag under the Block plugins list.
- Place the block in the sidebar under Settings → Website → Appearance → Sidebar.
- 3.5 compatibility:
PKP\session\SessionManagerwas removed in 3.5 (session handling moved to a Laravel-based guard), so the plugin now usesPKP\core\PKPSessionGuard::isSessionDisable(). - Consistent casing (OJSBR): the ICU library returns each language's endonym with its native
casing (
English, butespañol/portuguêsin lowercase). This build normalizes every language name to an initial uppercase letter — multibyte-safe — so the list readsEnglish / Español / Português.
-
PHPUnit (
tests/*Test.php, onPKP\tests\PKPTestCase): the classes against the installed PKP, the plugin found by PKP's plugin registry, the stylesheet rules matching the flag images shipped, flags only for languages that have one, escaping in the template and the 38 translations. From the application root:lib/pkp/lib/vendor/bin/phpunit --configuration lib/pkp/tests/phpunit.xml --no-coverage "$PWD/plugins/blocks/languageToggleByFlag/tests" -
Cypress (
cypress/tests/functional/LanguageToggleByFlag.cy.js, run by pkp-github-actions on OJS, OMP and OPS on every push): enables the plugin and places the block in the sidebar, then on a reader page checks that the stylesheet loads once, the flags are drawn, the link of a language carries the host and the current page (it fails with the path-only link of releases before 3.5.0.4) and brings the reader back to the same page, also when the browser sends noReferer. That last check is skipped where the web server's name is not the host of the site, as in PKP's CI (127.0.0.1 behindhttp://localhost), where the corelanguageToggleblock goes to the site index too. The sidebar is put back after the run. -
Verified on OJS 3.5.0.3.
Tests are kept in the repository and are not part of the release package.
- Maintained by OJSBR — adaptation to PKP 3.5.
- Original work:
languageToggleByFlagby Lepidus Tecnologia (https://github.com/lepidus/languageToggleByFlag), © Lepidus Tecnologia 2019–2024, © Simon Fraser University / John Willinsky. - Distributed under the GNU GPL v3, consistent with the original licensing.
Generative AI (Claude, by Anthropic) was used to write and run tests, improve the code and bring it in line with PKP standards. Every change is reviewed and tested by OJSBR, which is responsible for the published releases.
Issues and pull requests are welcome — see CONTRIBUTING.md.
Distributed under the GNU GPL v3. See LICENSE and docs/COPYING.
Plugin de bloco para Open Journal Systems (OJS), Open Monograph Press (OMP) e Open Preprint Systems (OPS) que exibe o seletor de idiomas na barra lateral como uma lista de bandeiras com o nome de cada idioma, no lugar do seletor padrão simples.
Mantido pela OJSBR. Adaptado para o PKP 3.5 a partir do plugin original
languageToggleByFlagda Lepidus Tecnologia. Veja a seção Créditos e autoria abaixo.
O seletor de idiomas padrão é uma lista simples de nomes. Numa revista multilíngue, quem não lê o idioma atual da interface precisa achar o seu nessa lista; a bandeira ao lado de cada nome torna o seletor reconhecível de relance.
- Lista os idiomas ativos no site ou na revista, cada um com o nome no próprio idioma e, quando o plugin traz a imagem, uma bandeira (24 bandeiras). Idiomas sem bandeira aparecem só com o nome.
- Trocar de idioma mantém o leitor na mesma página.
- Instale em Configurações → Website → Plugins → Enviar um novo plugin, ou extraia a pasta
em
plugins/blocks/(ficandoplugins/blocks/languageToggleByFlag/). - Ative o Language Toggle By Flag na lista de plugins de Bloco.
- Posicione o bloco na barra lateral em Configurações → Website → Aparência → Barra lateral.
- Compatibilidade 3.5: a classe
PKP\session\SessionManagerfoi removida no 3.5 (a sessão passou a ser gerenciada pelo Laravel), então o plugin agora usaPKP\core\PKPSessionGuard::isSessionDisable(). - Padronização de maiúsculas (OJSBR): o ICU devolve o endônimo de cada idioma com a grafia
nativa (
English, masespañol/portuguêsem minúscula). Esta versão normaliza todos os nomes para inicial maiúscula (seguro para acentos), exibindoEnglish / Español / Português.
PHPUnit em tests/ (sobre PKP\tests\PKPTestCase) e Cypress em cypress/tests/functional/
(rodado pelo pkp-github-actions no OJS, OMP e OPS a
cada push), com os comandos da seção em inglês. A suíte cobre as classes contra o PKP instalado, o
plugin encontrado pelo registro de plugins, as regras do CSS batendo com as bandeiras distribuídas,
bandeira só para idioma que tem imagem, escape no template e as 38 traduções. O Cypress liga o
plugin, põe o bloco na barra lateral e, numa página do leitor, confere o CSS carregado uma vez, as
bandeiras, que o link de cada idioma leva host e página atual (falha com o link só com caminho das
versões anteriores à 3.5.0.4) e devolve o leitor à mesma página, inclusive sem Referer; essa
última conferência é pulada quando o nome do servidor web não é o host do site, como no CI da PKP
(127.0.0.1 atrás de http://localhost), onde o bloco languageToggle do núcleo também vai para o
índice do site. A barra lateral volta ao que era no fim.
Verificado no OJS 3.5.0.3.
Os testes ficam no repositório e não fazem parte do pacote da release.
- Mantido pela OJSBR — adaptação para o PKP 3.5.
- Trabalho original:
languageToggleByFlagda Lepidus Tecnologia (https://github.com/lepidus/languageToggleByFlag), © Lepidus Tecnologia 2019–2024, © Simon Fraser University / John Willinsky. - Distribuído sob a GNU GPL v3, coerente com o licenciamento original.
Foi usada IA generativa (Claude, da Anthropic) para escrever e rodar testes, melhorar o código e alinhá-lo aos padrões da PKP. Toda mudança é revisada e testada pela OJSBR, que responde pelas releases publicadas.
Distribuído sob a GNU GPL v3. Veja LICENSE e docs/COPYING.