Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Brazilian Portuguese and Danish language selectors #801

Merged
3 commits merged into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ Following languages are currently supported/translated:

- Bulgarian
- Chinese
- Danish
- Dutch
- English
- Esperanto
Expand All @@ -305,6 +306,7 @@ Following languages are currently supported/translated:
- Japanese
- Polish
- Portuguese
- Portuguese (Brazil)
- Russian
- Spanish
- Turkish
Expand Down
5 changes: 3 additions & 2 deletions assets/controllers/timeago_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Controller } from '@hotwired/stimulus';
// eslint-disable-next-line -- grouping timeago imports here is more readable than properly sorting
import * as timeago from 'timeago.js';
import bg from 'timeago.js/lib/lang/bg';
import da from 'timeago.js/lib/lang/da';
import de from 'timeago.js/lib/lang/de';
import el from 'timeago.js/lib/lang/el';
import en from 'timeago.js/lib/lang/en_US';
Expand All @@ -12,7 +13,7 @@ import it from 'timeago.js/lib/lang/it';
import ja from 'timeago.js/lib/lang/ja';
import nl from 'timeago.js/lib/lang/nl';
import pl from 'timeago.js/lib/lang/pl';
import pt from 'timeago.js/lib/lang/pt_BR';
import pt_BR from 'timeago.js/lib/lang/pt_BR';
import ru from 'timeago.js/lib/lang/ru';
import tr from 'timeago.js/lib/lang/tr';
import uk from 'timeago.js/lib/lang/uk';
Expand All @@ -28,7 +29,7 @@ export default class extends Controller {
}

const lang = document.documentElement.lang;
const languages = { bg, de, el, en, es, fr, it, ja, nl, pl, pt, ru, tr, uk, zh_TW };
const languages = { bg, da, de, el, en, es, fr, it, ja, nl, pl, pt_BR, ru, tr, uk, zh_TW };

if (languages[lang]) {
timeago.register(lang, languages[lang]);
Expand Down
2 changes: 1 addition & 1 deletion templates/layout/_sidebar.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
{% set current = app.request.cookies.get('kbin_lang') ?? header_accept_language ?? kbin_default_lang() %}
<li>
<select data-action="kbin#changeLang">
{% for code in ['bg', 'de', 'el', 'en', 'eo', 'es', 'fr', 'it', 'ja', 'nl', 'pl', 'pt', 'ru', 'tr', 'uk', 'zh_TW'] %}
{% for code in ['bg', 'da', 'de', 'el', 'en', 'eo', 'es', 'fr', 'it', 'ja', 'nl', 'pl', 'pt', 'pt_BR', 'ru', 'tr', 'uk', 'zh_TW'] %}
<option value="{{ code }}" {{ code is same as current ? 'selected' : '' }}>{{ code|language_name(code) }}</option>
{% endfor %}
</select>
Expand Down
Loading