-
Notifications
You must be signed in to change notification settings - Fork 254
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
[3.0] Languages Overhaul #7853
[3.0] Languages Overhaul #7853
Conversation
I've moved this to the 3.0 Alpha 2 milestone. For Alpha 1, the only goals are:
|
The syntax check failed, but that should be an easy fix. Looks like you're just missing some trailing commas. In order to pass the build tools check, you'll need to update the BuildTools repository so that the scripts look in the correct place for the language files depending on the version, and then update composer.lock so that it uses the correct version of BuildTools for the checks. |
Antechinus suggested we do a per directory language. So we would do /Languages/english/index.english.php. We could drop the language out of the filename as well. This may also be a good time to discuss. Should we also go locale for our naming instead of our custom method. So index.english.php becomes index.en-us.php. @Dzonny any opinion on that? |
I like the idea and support it. |
You have an idea of what you think it would be the best source of truth regarding how we associate a locale to a language? You can already do sub folders with languages. Just call it with the folder name. SimpleDesk already do this:
|
Yes I'm aware of that I do the same and Bugo does it too. I was referring to the folder per language format. For example, a MOD would now have this structure:
I know some of our language translations are mixed in this regard, so I'm not sure either which one would be preferred. |
The CLDR is standard. Using it to designate our locales and languages will greatly simplify the interactions between our language files and other PHP functions. |
@DiegoAndresCortes Correct, they would be that way. Although with the locale discussion it would be /en-us/Simpledesk and /es-mx/SimpleDesk. @Sesquipedalian I agree, which is why I suggested it. We would also be able to build in support to read the users locale in their request, check it against our known language list of locales, and then change to that language. No funky workarounds needed. I don't think I need to target that with this PR, but moving us over to en-us and the folder structure seems to be a win all around that we can make for this major release. |
Yeah, I would want us to follow the CLDR rather than any vendor-specific variant. Reorganizing all the language files into subdirectories named after CLDR locale strings is an excellent plan. I would prefer to see the same structure enforced for theme-specific language files as well. Stricter consistency is actually easier for everyone to understand and work with in the long run. |
Moving this to draft. I still need to finish the upgrader work. The upgrader will have to handle updating the members table with a old => new. This got things working for me. |
One thing: It would be best to use the canonical forms of locale labels in all cases. The canonical forms use underscores rather than hyphens between label parts, and the country code part is always uppercase. So, An easy way to get the canonical form of any locale label is by using Locale::Canonicalize. (I also posted this comment on the related BuildTools pull request.) |
I think we can make that work. I wanted it to be able to handle the browser information as sent by the browser. Appears to be able to work:
Passing in |
I'm going to need help from @Dzonny and the rest of our translators. To handle the upgrade logic, we need to convert our custom naming format to the proper locales.
Going to start with the localization team and go from there. |
I realize that list will have to be in the source code. To maintain compatibility with older mods, we will have to handle the old languages. They would also install into the root language folders, instead of in the sub directories. But we only really need to do this for non system files or mods that are not fully compatible. @Sesquipedalian I think it would be best if I triggered something that only happened if we call from a combat situation. Seems like we could modify the loadLanguage legacy call to pass an additional param, which would then allow the fallback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No testing yet from me atm, but this also needs to be removed:
SMF/Themes/default/index.template.php
Lines 56 to 57 in b730ca9
// Set the following variable to true if this theme requires the optional theme strings file to be loaded. | |
Theme::$current->settings['require_theme_strings'] = false; |
ba3ca35
to
a93bf38
Compare
…ion data Fix issue with users that have a session language unable to affect the forum language when changing with ?language Fix issue that locale detection affects logged in users who have defined a language
…for UTF-8 migration.
120c457
to
3885285
Compare
@Sesquipedalian I feel this is ready now. |
Cool. I'll review it in the next day or two. |
Signed-off-by: Jon Stovell <[email protected]>
Signed-off-by: Jon Stovell <[email protected]>
Signed-off-by: Jon Stovell <[email protected]>
Signed-off-by: Jon Stovell <[email protected]>
Signed-off-by: Jon Stovell <[email protected]>
Signed-off-by: Jon Stovell <[email protected]>
Signed-off-by: Jon Stovell <[email protected]>
Signed-off-by: Jon Stovell <[email protected]>
Signed-off-by: Jon Stovell <[email protected]>
I found a few issues. It was easier to fix them than it was to document them all in review comments. How do my changes look to you, @jdarwood007? |
Looks good. I thought I had tested the language editor, but I must have broken it since I last tested it. Do we need another set of eyes on this since you made changes? |
Also note, that I haven't reviewed the changes we need to make to Crowdin. We haven't even discussed that yet on how we handle this. I will get a discussion going on the team boards as we also need to get the branch going in Crowdin. |
If you can just take a moment to make sure that file select box populates correctly on your machine, that should be enough.
A discussion will be good. I had no involvement with setting up the CrowdIn integration, so I have no more idea than the next guy about what needs to be done there. As I recall, @sbulen was the primary developer involved with that at the time, so maybe start the discussion in the Development Contributors board so that he can participate in the discussion. |
Nice catch. I think we can go ahead a merge this now. |
Move the languages directory form
/Themes/default/languages
to/Languages
Additionally, this also moves agreement.txt from
/
to/Languages
$languagesdir
which defaults to__DIR__ . '/Languages'
/Languages/en_US/
/Themes/*/languages
, we do deprecate the usage of this for override.Settings.{language}
to{locale}/ThemeStrings
to encourage themes to use this as an alternative to modifying base languages@DiegoAndresCortes Can you review the theme's logic is sound.
Todo:
$themesdir/default/languages
$languagedir
(and$languages_dir
) with the old paths. The issue is how we handle the logic for migration to the 'new' paths.$languagedir