Commit Graph

103 Commits (jtr/fix-public-exceptions-http-codes)

Author SHA1 Message Date
Joas Schilling 9e4ac50206
fix(l10n): Don't fallback from 3-letter languages to 2-letter
Signed-off-by: Joas Schilling <coding@schilljs.com>
2025-10-16 11:46:01 +07:00
Côme Chilliet fc85555d0c
fix: Fix phpdoc typing for IL10N::l $data parameter
The implementation supports passing null and our code is using that,
 reflect it in the public API.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-09-29 12:31:30 +07:00
Ferdinand Thiessen 5981b7eb51
chore: apply new CSFixer rules
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>

# Conflicts:
#	apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
2025-07-01 16:26:50 +07:00
Côme Chilliet 579a337750
fix: Fix psalm taint error in L10N factory
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-02-17 15:24:07 +07:00
Côme Chilliet 5a05af05db
feat(l10n): Respect forceLanguage query parameter in more places
Attempt to make L10N Factory consistent with itself when forceLanguage
 query parameter is used.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-10-08 15:40:40 +07:00
Côme Chilliet 1b8949ebac
feat(l10n): Allow to force language with a query parameter
This will be used by support application to always generate the support
 report in english. It may also be used to debug a language, or to
 temporarily show a page in an other language to take a screenshot or to
 share your screen with someone speaking another language.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-10-08 14:44:03 +07:00
Joas Schilling 234c44a77e
fix(l10n): Fix list of RTL languages
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-09-27 12:50:30 +07:00
Joas Schilling 82566c5479
fix(rtl): Make clear that the direction is based on language
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-09-23 17:00:07 +07:00
Joas Schilling ae06ab5860
fix(rtl): Fix list of RTL languages
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-09-23 16:59:49 +07:00
ali ghorbani 2b7efd66b6
feat(rtl): Set layout direction based on language
Signed-off-by: ali ghorbani <ghorbani.ali.developer@gmail.com>
2024-09-23 16:59:20 +07:00
provokateurin 9836e9b164
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-19 14:21:20 +07:00
Côme Chilliet 7ed583cb8e
chore: Migrate cleanAppId and getAppPath calls to IAppManager from OC_App
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-09-13 10:08:43 +07:00
Daniel Kesselberg af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +07:00
Misha M.-Kupriyanov aceb4d776c feat: reduce available languages per config value "reduce_to_languages"
Example: restrict to en, de, es, fr, it' languages

./occ config:system:set reduce_to_languages 0  --value  en
./occ config:system:set reduce_to_languages 1  --value  de
./occ config:system:set reduce_to_languages 2  --value  es
./occ config:system:set reduce_to_languages 3  --value  fr
./occ config:system:set reduce_to_languages 4  --value  it

Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
2024-07-01 09:34:11 +07:00
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +07:00
Côme Chilliet a0be3ffdf2
fix: Fix tests following OC_App migrations to IAppManager
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-22 12:21:55 +07:00
Côme Chilliet 733a818139
fix: Migrate a few more classes away from OC_App::getAppPath
Also fixed AppTest

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-22 12:19:01 +07:00
Côme Chilliet ec5133b739 fix: Apply new coding standard to all files
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-02 14:16:21 +07:00
Côme Chilliet c0ce272e9c chore: Migrate away from OC::$server->getLogger
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-02-13 17:32:30 +07:00
c39cfbb3 1bf15da863 Update lib/private/L10N/Factory.php
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: c39cfbb3 <145777845+c39cfbb3@users.noreply.github.com>
2023-10-18 02:33:54 +07:00
c39cfbb3 f7cd3d17b8 L10N/Factory: Support "Accept-Language: zh-Hans-CN" and alike
Signed-off-by: c39cfbb3 <145777845+c39cfbb3@users.noreply.github.com>
2023-10-18 02:33:54 +07:00
Hamid Dehnavi d0b20534b9 Refactor "substr" calls to improve code readability
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
2023-07-07 04:54:20 +07:00
Joas Schilling ab8205fd35
fix(l10n): Fix plural issue with different locale and language
We need to use the language code here instead of the locale,
because Symfony does not distinguish between the two and would
otherwise e.g. with locale "Czech" and language "German" try to
pick a non-existing plural rule, because Czech has 4 plural forms
and German only 2.

Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-06-21 07:14:56 +07:00
Faraz Samapoor e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +07:00
Côme Chilliet 8d5165e8dc
Adapt tests to config value typing
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-05 17:42:14 +07:00
Côme Chilliet 426c0341ff
Use typed version of IConfig::getSystemValue as much as possible
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-05 12:50:08 +07:00
Côme Chilliet f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +07:00
Julius Härtl 306d7829b5
Cache available languages locally
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2022-12-07 22:32:06 +07:00
Côme Chilliet c54fb5f9e6
Use {$var} instead of ${var} for PHP 8.2 compatibility
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-06-14 15:12:28 +07:00
Joas Schilling 26882a4b59
Fix translations with trailing colons
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-04-26 11:06:00 +07:00
Joas Schilling f03468342e
Remove createPluralFunction which is replaced by Symfony\Translations lib
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-01-24 09:27:01 +07:00
Jonas Meurer a6f0278e67
Default to language from request in L10N\Factory->getUserLanguage()
Try to get the language from request before falling back to the instance
default.

This fixes the detected user language during first login of a new user
and ensures that the returned language is consistent during the login.

Also partially fixes a bug with Collectives folder being initialized
in different languages at first login, see
https://gitlab.com/collectivecloud/collectives/-/issues/238

Signed-off-by: Jonas Meurer <jonas@freesources.org>
2022-01-10 13:06:23 +07:00
Côme Chilliet af7bf98cba
Fix Iterator return types
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:28:57 +07:00
Côme Chilliet 113756db30
Fix ArrayAccess and JsonSerializable return types
First round of modifications for PHP 8.1

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:28:56 +07:00
Christopher Ng 7215148a24 Add new account properties
- New properties
  - Organisation
  - Role
  - Headline
  - Biography
  - Profile Enabled property
- Fix errors with building default account properties
- Fix L10N factory method `getLanguage` not public error
- Update tests

Signed-off-by: Christopher Ng <chrng8@gmail.com>
2021-10-19 04:44:40 +07:00
Christoph Wurst 5b727fc7da
Add L10n factory method for generic language heuristics
The existing `findLanguage` method tries its best to find the best
language for the current users. For some tasks we don't want this but
rather determine the most generic language for *another* user, e.g. when
the current user trigger an email notifiaction to someone else. In this
case the current user's language is a bad guess in many multi-language
environments.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-10-13 09:57:21 +07:00
Christopher Ng cc5815dcd0 Provide initial state
- camelCase language strings

Signed-off-by: Christopher Ng <chrng8@gmail.com>
2021-08-27 05:06:12 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
Joas Schilling 3cf447ac44
Fix PHP CS
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-04-20 16:43:43 +07:00
Joas Schilling 5a514a9a41
Correctly replace all PHP placeholders with the parameters
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-04-20 16:42:05 +07:00
Joas Schilling 439457d2b4
Fix languages that miss a string in the translation
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-04-20 16:42:04 +07:00
Joas Schilling a4c6749b02
Add a check for the pipe character
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-04-20 16:42:04 +07:00
Joas Schilling 157147cb8e
"Symfony\Component\Translation\PluralizationRules" is deprecated
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-04-20 16:42:04 +07:00
dependabot-preview[bot] eb502c02ff
Bump nextcloud/coding-standard from 0.3.0 to 0.5.0
Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/nextcloud/coding-standard/releases)
- [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nextcloud/coding-standard/compare/v0.3.0...v0.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-02-18 13:31:24 +07:00
Morris Jobke 24d436cb60
Remove unneeded casts that were found by Psalm
In preparation of the update of Psalm from 4.2.1 to 4.3.1+ (see https://github.com/nextcloud/server/pull/24521)

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2021-01-11 13:14:41 +07:00
Roeland Jago Douma 441a3434f3
Move localecache to array
It seems the DS Set in the polyfill implementation is a lot less
efficient than normal arrays. (A LOT!).
So for now use a stupid normal array.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-11-02 15:02:04 +07:00
Roeland Jago Douma 6e377a9daf
Only parse the locales ones
Before we'd go over the entire list for each translation (so each app)
we'd use translation for. This means we'd also go over thise locale list
(currently containing 750 entries) * apps so often this added up to ~20k
calls.

now we just dump the locales in a set once and then check if the entry
is there.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-10-31 15:25:19 +07:00
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-08-24 14:54:25 +07:00
Joas Schilling b997edad10
Add a dedicated method to get the language for another user
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-07-01 10:20:07 +07:00
GretaD fce716b905
Fix languages empty array
Signed-off-by: GretaD <gretadoci@gmail.com>
2020-05-08 10:03:58 +07:00