Plugin multilíngue 🌐

O Plugin MultilĂ­ngue torna possĂ­vel para administradores de fĂłruns multilĂ­ngues criar um ambiente rico e compreensĂ­vel para todos os usuĂĄrios e convidados, mesmo que nĂŁo falem o idioma padrĂŁo ou a maioria dos idiomas do fĂłrum.

:page_facing_up: Obter o cĂłdigo

:book: Ler a documentação


VisĂŁo geral dos recursos

O Plugin MultilĂ­ngue estende o sistema de localidade (locale) existente do Discourse para oferecer:

  1. uma interface administrativa para todos os idiomas usados no seu fĂłrum;

  2. um sistema de idioma de conteĂșdo que permite que vocĂȘ e seus usuĂĄrios filtrem o conteĂșdo do fĂłrum por idioma;

  3. uma integração com o Plugin Tradutor do Discourse, que automatiza aspectos do sistema de idioma de conteĂșdo;

  4. a capacidade de traduzir nomes de categorias, tags e outros textos semiestĂĄticos no seu fĂłrum;

  5. a capacidade de desabilitar o uso de idiomas de interface existentes no seu fĂłrum;

  6. a capacidade de adicionar idiomas de interface personalizados (“locales”) diretamente ao seu fórum;

  7. recursos aprimorados para idioma de convidados, incluindo um seletor de idioma de interface (‘locale’) para convidados (como uma barra de rodapĂ© ou menu); e

  8. campos opcionais de idioma de interface e idioma de conteĂșdo no cadastro (em breve).


:point_right: ObservaçÔes importantes

Todos os recursos acima funcionam sobre o sistema de localidade (locale) existente do Discourse e em conjunto com todos os recursos desse sistema (veja a explicação mais detalhada aqui).

Se vocĂȘ deseja adicionar idiomas de interface (“locales”) ao Discourse, a melhor maneira de fazer isso Ă© seguindo as etapas descritas aqui: How to add a new language. VocĂȘ tambĂ©m pode adicionar um locale por meio de um plugin, conforme descrito aqui.

A capacidade de fazer isso por meio da interface administrativa deste plugin deve ser considerada apenas após esgotar os métodos suportados pelo Discourse. Quaisquer idiomas adicionados ao Discourse por meio dos métodos suportados pelo Discourse estarão automaticamente disponíveis para todos os recursos deste plugin.


Capturas de tela de exemplo

Interface administrativa

TraduçÔes de texto semieståtico (e seletor de locale para convidados)

Sistema de idioma de conteĂșdo

Screen Shot 2020-02-25 at 2.24.51 PM

Integração do Plugin Tradutor com o sistema de idioma de conteĂșdo


Créditos

Este plugin foi possível graças ao apoio da Fundação Wikimedia, com suporte especial de @Elena_Lappen e @icaria36, que tiveram contribuição significativa no design do conjunto de recursos.

Para mais discussÔes sobre o raciocínio por trås deste plugin, consulte:

Structuring a multilingual community

68 curtidas

Wow! You have been busy. :slight_smile: Nice work, @angus! Look forward to seeing examples of this in the wild. Let me know if you need somebody like me to look at it and give feedback.

One gap has been the lack of a feature to enable staff to improve translations of posts provided by the translate plugin - is that going to be part of this effort?

10 curtidas

hm. I’m not rulling it out, but that is probably more in the scope of the Translate Plugin.

A somehwat related feature which I built at one point for something else is a little count icon that shows for users when the locale they’re using falls back to the default locale because a translation is missing. Click the icon and you see:

“x translations missing for this page. Help us translate them here: (link to discourse’s transifex).”

7 curtidas

Fantastic work as usual Angus! I’ve been testing it on my site and have a couple of small issues and some questions.

Issues

  1. When you edit an existing topic the dropdown menu text does not follow the theme colors:

image

  1. The content language setting becomes very hard to use beyond a couple of languages due to the single line

Questions

  1. It seems as though many of our old topics are getting the language tag retroactively, which is desired, but only a handful at this point. Will a job run to apply the tag to all existing posts eventually? If not, is there a way to apply a language tag to all existing posts? Our site has been only English up to this point so I want all existing posts to have the en tag.
  2. When you have multiple languages set under content languages should you be able to filter by an individual language? Currently when I click one of the languages in the drop down nothing happens.
2 curtidas

Thanks for the feedback David and giving this a shot. I’ve pushed a number of udpates that, among other things, fix the two problems you mention above.

Not yet. Currently only the posts translated by the Translator plugin will automatically get a content tag retroactively (if the translator plugin is enabled and the sync feature is enabled).

I can add such a job, but it’ll need to take a specific language as a parmeter and run on a defined scope. In addition to a ‘site wide’ scope, I could do it on a per-category, or per (non-content) tag basis (i.e. apply this content tag to all topics in this category or with this other tag). What would work for you?

No, the list is mean to just show you what your content languages are currently set at. Could you walk me through how you expect (or would like) this to behave?

2 curtidas

Thank you Angus, that fixed up my problems.

Ideally I would like to have the en tag applied to all existing posts that do not have a language tag, is that too broad? The problem is that if a user sets their content language to say English and Spanish, they will then only see the posts with the language tag, they will not see the thousands of posts that have no tag.

Because there is a list and they highlight when hovered, it gives the impression that they are clickable. My expectation in that case is that when you click on one of them your posts would be filtered by that language. I think this could be a useful feature to filter by language, but it’s not something I’m dying to have either.

On another note; I would love to have the option to move the language button. I have a lot of items in my nav bar already and it’s starting to get cluttered. Also the highlighted button looks out of place above the new topic button and it’s forcing the new topic button below. I suppose it’s not possible to move it to the beginning of the navbar, say before Latest? Or it could be floating in a corner like I have on my wordpress homepage https://naturephotographers.network , or it could go in the header similar to the option in the translate plugin.

I understand your reasoning for putting it in the navbar, because you are filtering similar to the other buttons, but the thing is that you would only set this once and then forget it. It’s not like you would be regularly filtering by different languages.

Thanks again, this plugin along with translate is a game changer.

3 curtidas

To me, this is the desired behavior. Users must not see posts in a foreign language. If there is no post is their language, they must see no post.

However, as an option, a “bulk tagging” feature would be nice.

2 curtidas

Agreed, the solution I proposed on Pavilion is if the default locale matches one of the selected topic languages, then show all posts without tags. But bulk tagging would be the better option.

@angus, I am not 100% sure if this is related to your plugin or a change in core, but there may be a bug I’ve come across. When I edit an existing post, make some changes and try to save I get this error None of the tags you selected can be used, there are no tags set except the en tag, and minimun number of tags required in a topic is set to 0. Any ideas?

2 curtidas

Ran into another issue today Angus, I previously had an ig tag (short for instagram) that was deleted by the plugin to make way for the Igbo language. I assume there’s no way to get this back? I tried turning off the plugin in hopes that it may still be there, but alas it appears to be long gone. I know this a risk you take when testing plugins. You might want to add a warning that it will delete any tags with the same name.

3 curtidas

I’ll pm you about that (It’s unlikely to be lost)

The other useful suggestions and feedback, I’ll be reviewing tomorrow.

3 curtidas

My Godness! You are fantastic!
I mean, I really admire you. While I also hope this post will not distract people’s attention on your fabulous work.

7 curtidas

Apenas uma observação: David e eu resolvemos esse problema e restauramos as tags ig existentes.

Se houver um conflito entre uma tag prĂ©-existente e uma tag de idioma de conteĂșdo, o idioma nĂŁo estarĂĄ disponĂ­vel como idioma de conteĂșdo atĂ© que o conflito seja resolvido. VocĂȘ verĂĄ isso no seu painel de idiomas.

Vou abordar quaisquer outros problemas e solicitaçÔes de recursos na próxima semana.

9 curtidas

Prezado Angus, Ă© possĂ­vel usar apenas o seletor de idioma para os hĂłspedes?
Não preciso utilizar todas as funcionalidades deste sistema — preciso apenas permitir que o hóspede altere o idioma da interface.

2 curtidas

Cada recurso do plugin funciona de forma independente.

Instale o plugin e ative apenas o seletor de idioma: Pavilion.

Atualmente, usamos este plugin para esse fim no thepavilion.io.

4 curtidas

Trabalho fantĂĄstico, @angus!

Instalamos o plugin, mas agora nenhum conteĂșdo estĂĄ visĂ­vel para os usuĂĄrios, nem mesmo para a equipe. No entanto, ao editar uma categoria e tentar excluĂ­-la, recebemos o seguinte aviso:

A Ășnica maneira de acessar um tĂłpico Ă© seguir o link na mensagem de aviso ou conhecer a URL do tĂłpico. Se acessarmos o tĂłpico (RIO Paris) e adicionarmos uma tag de idioma de conteĂșdo, digamos “inglĂȘs”, ele se torna visĂ­vel como esperado. Nossa suposição Ă© que o plugin MultilĂ­ngue estĂĄ funcionando perfeitamente. Apenas o conteĂșdo associado a uma tag Ă© exibido. No entanto, achamos enganoso e confuso quando as pessoas nĂŁo conseguem ver todos os tĂłpicos relacionados sem associar uma tag de idioma. Temos milhares de tĂłpicos publicados anteriormente que estĂŁo invisĂ­veis. Existe uma solução para atribuir rapidamente uma tag de idioma a eles, jĂĄ que nĂŁo conseguimos ver uma lista no momento?

Por favor, oriente-nos.

Edição: Resolvi meu problema de visibilidade marcando todos os tópicos de certas categorias com a tag correspondente ao idioma que deveriam usar, no Rails:

  1. cd /var/discourse e depois ./launcher enter app
  2. Obter os IDs das categorias com rake categories:list
  3. Se uma categoria que deve conter apenas tĂłpicos em alemĂŁo for a 245, execute rake tags:bulk_tag_category["de",245]
1 curtida

Obtenho uma pĂĄgina em branco apĂłs executar
./launcher rebuild app

Descobri que é este plugin que causa o problema. Não consigo abrir o site nem a parte de administração.
Ativei apenas o conteĂșdo multilĂ­ngue, mas nĂŁo preenchi nada.

Como posso redefinir as configuraçÔes desse plugin no banco de dados?

O endereço your.website.com/safe-mode funciona?

Desativei este plugin agora. Os problemas começaram com o desaparecimento da lista de plugins no painel de administração. Depois disso, tentei reconstruir o aplicativo. Mas, após a reconstrução, o site não abriu. Agora ele abre, mas com este plugin desativado.

@angus, vocĂȘ pode verificar seu plugin com uma versĂŁo recente do Discourse?

No modo de segurança, sem plugins não oficiais, vejo esta pågina sem a lista de plugins:

Modo de segurança sem todos os plugins:

É possĂ­vel redefinir as configuraçÔes deste plugin no banco de dados?

Naquela Ă©poca, nenhum modo conseguia resolver o problema (seguro, sem versĂ”es nĂŁo oficiais, sem tudo) — em todos os modos, eu nĂŁo via uma lista de plugins instalados no sistema.

1 curtida