Commit Graph

89 Commits (master)

Author SHA1 Message Date
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 week ago
Côme Chilliet a0be3ffdf2
fix: Fix tests following OC_App migrations to IAppManager
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 month ago
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>
1 month ago
Côme Chilliet ec5133b739 fix: Apply new coding standard to all files
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2 months ago
Côme Chilliet c0ce272e9c chore: Migrate away from OC::$server->getLogger
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
4 months ago
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>
8 months ago
c39cfbb3 f7cd3d17b8 L10N/Factory: Support "Accept-Language: zh-Hans-CN" and alike
Signed-off-by: c39cfbb3 <145777845+c39cfbb3@users.noreply.github.com>
8 months ago
Hamid Dehnavi d0b20534b9 Refactor "substr" calls to improve code readability
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
11 months ago
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>
12 months ago
Faraz Samapoor e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
1 year ago
Côme Chilliet 8d5165e8dc
Adapt tests to config value typing
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 year ago
Côme Chilliet 426c0341ff
Use typed version of IConfig::getSystemValue as much as possible
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 year ago
Côme Chilliet f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 year ago
Julius Härtl 306d7829b5
Cache available languages locally
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2 years ago
Côme Chilliet c54fb5f9e6
Use {$var} instead of ${var} for PHP 8.2 compatibility
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2 years ago
Joas Schilling 26882a4b59
Fix translations with trailing colons
Signed-off-by: Joas Schilling <coding@schilljs.com>
2 years ago
Joas Schilling f03468342e
Remove createPluralFunction which is replaced by Symfony\Translations lib
Signed-off-by: Joas Schilling <coding@schilljs.com>
2 years ago
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>
2 years ago
Côme Chilliet af7bf98cba
Fix Iterator return types
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
3 years ago
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>
3 years ago
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>
3 years ago
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>
3 years ago
Christopher Ng cc5815dcd0 Provide initial state
- camelCase language strings

Signed-off-by: Christopher Ng <chrng8@gmail.com>
3 years ago
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
3 years ago
Joas Schilling 3cf447ac44
Fix PHP CS
Signed-off-by: Joas Schilling <coding@schilljs.com>
3 years ago
Joas Schilling 5a514a9a41
Correctly replace all PHP placeholders with the parameters
Signed-off-by: Joas Schilling <coding@schilljs.com>
3 years ago
Joas Schilling 439457d2b4
Fix languages that miss a string in the translation
Signed-off-by: Joas Schilling <coding@schilljs.com>
3 years ago
Joas Schilling a4c6749b02
Add a check for the pipe character
Signed-off-by: Joas Schilling <coding@schilljs.com>
3 years ago
Joas Schilling 157147cb8e
"Symfony\Component\Translation\PluralizationRules" is deprecated
Signed-off-by: Joas Schilling <coding@schilljs.com>
3 years ago
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>
3 years ago
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>
3 years ago
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>
4 years ago
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>
4 years ago
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Joas Schilling b997edad10
Add a dedicated method to get the language for another user
Signed-off-by: Joas Schilling <coding@schilljs.com>
4 years ago
GretaD fce716b905
Fix languages empty array
Signed-off-by: GretaD <gretadoci@gmail.com>
4 years ago
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 734c62bee0
Format code according to PSR2
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 28f8eb5dba
Add visibility to all constants
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 44577e4345
Remove trailing and in between spaces
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst afbd9c4e6e
Unify function spacing to PSR2 recommendation
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 1a9330cd69
Update the license headers for Nextcloud 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
4 years ago
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
5 years ago
Roeland Jago Douma 68748d4f85
Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
Christoph Wurst de6940352a Move settings to an app
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
5 years ago
Roeland Jago Douma b2cc5d8fb6
Make the L10N loading lazy
Fixes #15675
This makes loading of the actual L10N lazy. So we only detect and load
the actual translations when they are used. Instead of trying to load
them all the time just because an app is enabled.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
5 years ago
John Molakvoæ (skjnldsv) 7d158c62ce
Typehint
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
6 years ago