이 테마 컴포넌트는 사이트 헤더에 사용 가능한 언어 드롭다운 메뉴를 추가합니다. 사이트의 기본 언어에 익숙하지 않은 사용자에게 매우 유용합니다.
참고: 이 기능은 로그인한 사용자에게만 제공됩니다.
스폰서
이 컴포넌트의 스폰서를 맡아주신 @Richard_Millington님께 특별한 감사의 말씀을 드립니다.
13개의 좋아요
khenmu
(John Sweeney)
10월 3, 2022, 7:55오전
2
Having this be more prominent & including flags could really help people on multi-language forums.
Awesome addition to the ecosystem.
5개의 좋아요
Heliosurge
(Dan DeMontmorency)
1월 22, 2023, 7:26오전
6
This is an amazing fantastic feature! It is my recommendation the Team should consider adding this component minimally as a pre installed theme-component in core!
Thank you very kindly for releasing this!
2개의 좋아요
Heliosurge
(Dan DeMontmorency)
1월 22, 2023, 7:31오후
7
I have small feature request.
Would it be possible to have drop down link able to adjust on mobile?
If I enable the chat plugin it is going to be very crowded. Perhaps even have it configurable to use flags on Desktop with mobile using the 2 letters similar to wasvit earlier windows? Been Awhile. lol
Though scaling might work to be similar on size as the search mag glass
Heliosurge
(Dan DeMontmorency)
2월 11, 2023, 10:16오후
8
Just s9me feedback from one of members.
Great component
the selection of languages with the flags is cool, unfortunately contains some errors. Croatia has not received a flag.
Catalonia is a part of Spain.
Also can you share sime code to reduce flag size on Mobile?
Heliosurge
(Dan DeMontmorency)
3월 16, 2023, 5:13오후
9
Would it be possible to have an option to use the country code instead of the flags? Similar to keyboard language on Windows.l?
ie en es etc.. The flag is huge on mobile. Or an option to shrink the flag size.
Even a css overide would be handy. Thanks
1개의 좋아요
volanar
(Volanar)
7월 13, 2023, 3:59오후
10
Yes, this switch needs to be modified to match the general style of discourse. He’s terrible now
1개의 좋아요
Canapin
(Coin-coin le Canapin)
7월 18, 2023, 12:50오후
11
Screenshots of the current appearance for reference:
Desktop:
Mobile:
volanar
(Volanar)
7월 29, 2023, 12:40오후
12
This component does not work for me. Is there anything else to do besides turning it on and selecting a template?
Canapin
(Coin-coin le Canapin)
7월 31, 2023, 12:37오후
13
It needs at least a partial rework. If someone want to contribute and send PRs to fix various things, it’s welcomed
1개의 좋아요
volanar
(Volanar)
11월 5, 2023, 1:23오후
15
@volanar That’s not the same component.
1개의 좋아요
I’m removing the broken tag.
To begin with, the component was never broken!
There was a misunderstanding about another Discourse theme component that Volanar reported as broken.
I tested the component, which still works on the latest Discourse version.
However, it still requires some updates to modernize it, resolve a deprecation, and fix minor issues so it will work well on the latest Discourse version.
I went ahead and I made a PR (sponsored by @Richard_Millington )
https://github.com/Ahmedgagan/header-locale-selector/pull/3
6개의 좋아요
The PR has been merged; thanks, Ahmed.
4개의 좋아요
how use 2 or 3 lang and remove others lang ?
btw i optimized code for locale-selector.js:
import Component from "@ember/component";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { userPath } from "discourse/lib/url";
import { isTesting } from "discourse-common/config/environment";
export default class LocaleSelector extends Component {
@service currentUser;
get availableLocales() {
// Cache filtered locales for performance optimization
if (!this._filteredLocales) {
const allLocales = JSON.parse(this.siteSettings.available_locales);
this._filteredLocales = allLocales.filter(locale => ['en', 'ar'].includes(locale));
}
return this._filteredLocales;
}
@action
onChangeLocale(value) {
this.set("currentUser.locale", value);
ajax(userPath(`${this.currentUser.username_lower}.json`), {
data: { locale: this.currentUser.locale },
type: "PUT",
}).then(() => {
if (!isTesting()) {
location.reload();
}
});
}
defaultItem() {
const currentUserLocale = document.documentElement
.getAttribute("lang")
?.replaceAll("-", "_");
return (
this.content.find((val) => val.value === currentUserLocale) ||
this.content.find((val) => val.value === this.siteSettings.default_locale)
);
}
}
after test it discourse keeping freeze
any idea?
available_locales has this structure:
[
{
name: "English (US)",
value: "en"
},
...
]
So in your code you will need to use locale.value.
@Ahmed_Gagan 이 테마 컴포넌트에 새로운 문제가 있는 것 같습니다:
다음은 /logs에 표시되는 내용입니다:
Discourse AI: Errors during bulk classification: Failed to classify 98 posts (example ids: 1859, 1860, 2012, 1976, 1977) : ArgumentError : address cannot be nil or empty 9:06 pm 137 MaxMindDB (/var/www/discourse/vendor/data/GeoLite2-City.mmdb) could not be found: No such file or directory @ rb_sysopen - /var/www/discourse/vendor/data/GeoLite2-City.mmdb 9:06 pm 137 MaxMindDB (/var/www/discourse/vendor/data/GeoLite2-ASN.mmdb) could not be found: No such file or directory …
nat
(Natalie T)
11월 4, 2025, 11:04오전
24
여기서 참고할 점으로, 이 테마 구성 요소는 더 이상 필요하지 않으며, 위에서 나열된 사이트 설정에서 코어에 의해 지원됩니다. (문서 )