Open simpleidserver opened 9 months ago
I have implemented the following changes in the master
branch :
Language
table and displayed on the website.The language is no longer determined by the language of the user account used to run the service but by the Accept-Language
HTTP HEADER.
Please remember to update all records in the Translation
table and set the language to en
.
To support a new language, you can add a record to the Language
table, duplicate the values present in the Translation
table, and update the values accordingly.
I have implemented the following changes in the
master
branch :
- The default language is now set to English.
- The list of supported languages is stored in a
Language
table and displayed on the website.The language is no longer determined by the language of the user account used to run the service but by the
Accept-Language
HTTP HEADER. Please remember to update all records in theTranslation
table and set the language toen
.To support a new language, you can add a record to the
Language
table, duplicate the values present in theTranslation
table, and update the values accordingly.
1、Following your method, I made the following changes in the database: When I started the project and accessed 5002, all the languages in the top right corner disappeared, but I could vaguely see two places: Is there something else to configure, and changing the database isn't enough? 2、Assuming that the top right corner of 5002 is displayed correctly, I want to convert everything in the page to the language I need: Your current project is not supported, because I see that some of your hints seem to be written dead in the code. 3、If you do support what I said in question 2, where should I save my converted content? What am I going to do?
The Identity Server utilizes the translation and language tables to interpret certain metadata of the Backend entities, such as the Client name or the Configuration Property.
The majority of translations featured on the administration website are sourced from the Resources\Global.resx file. Unfortunately, this file is not complete, and all translations need to be relocated to this file. I have created ticket #693 for this purpose.
I have created a branch named "Ticket693," which illustrates how to update the project to accommodate the "French" language. I have implemented the following modifications:
Global.fr.resx
.Program.cs
file of the administration website and include fr
in the list of supported languages.IdServerConfiguration.cs
file of the Identity Server to introduce a new language along with its corresponding translation.https://github.com/simpleidserver/SimpleIdServer/commit/2fca56250cfde0b2847ed3577f4e1e9cf62eaf52
The Identity Server utilizes the translation and language tables to interpret certain metadata of the Backend entities, such as the Client name or the Configuration Property.
The majority of translations featured on the administration website are sourced from the Resources\Global.resx file. Unfortunately, this file is not complete, and all translations need to be relocated to this file. I have created ticket #693 for this purpose.
I have created a branch named "Ticket693," which illustrates how to update the project to accommodate the "French" language. I have implemented the following modifications:
- Add a new resource file
Global.fr.resx
.- Edit the
Program.cs
file of the administration website and includefr
in the list of supported languages.- Edit the
IdServerConfiguration.cs
file of the Identity Server to introduce a new language along with its corresponding translation.
Thank you for your hard work and look forward to the realization of this function.
The Identity Server utilizes the translation and language tables to interpret certain metadata of the Backend entities, such as the Client name or the Configuration Property.
The majority of translations featured on the administration website are sourced from the Resources\Global.resx file. Unfortunately, this file is not complete, and all translations need to be relocated to this file. I have created ticket #693 for this purpose.
I have created a branch named "Ticket693," which illustrates how to update the project to accommodate the "French" language. I have implemented the following modifications:
- Add a new resource file
Global.fr.resx
.- Edit the
Program.cs
file of the administration website and includefr
in the list of supported languages.- Edit the
IdServerConfiguration.cs
file of the Identity Server to introduce a new language along with its corresponding translation.
1 1、I followed your method and first copied your "Global.fr.resx" in "Resources" and changed the name to: Global.zh.resx: Then go to "Global.zh.Designer.cs" and replace "Global___Copier" with "Global_zh" (because it is a copied file, it conflicts with the original file) : And I have translated some of the content: 2、Then, in "SimpleIdServer. IdServer. Their Startup" of the Program. The cs in the following changes: 3、Then, in "SimpleIdServer. IdServer. Startup" "IdServerConfiguration. Cs" has carried on the following changes: 4、After starting the project, the following problems are found: The project is started by default in Chinese for the first time, but there is only Chinese option in the language box, and the other options are blank. When I click on the first blank (which should be the English option), the language box appears in all three languages: When I clicked "french" again, the last option in the language box went blank: When I clicked on the last blank again, just like at the beginning, the first two became blank again.
Another question is that the "SetDefaultCulture" we configured in "Program.cs" is "en". Why did the language box choose "Chinese" I added instead of English by default when I first visited it?
2 So far, I have found that the translation content is not comprehensive, such as the following: What do I do if I want to translate the entire content of the web (not just what is in the screenshot)? If I want to translate the entire content of the web (not just what is in the screenshot), do I have to replace all the text with @Global.xxxx?
Languages are not fully translated due to missing translations. For each language, a translation must be provided.
For example :
LanguageBuilder.Build(Language.Default).AddDescription("English").AddDescription("French", "fr").AddDescription("Chinese", "zh").Build(),
LanguageBuilder.Build("fr").AddDescription("Français", "fr").AddDescription("Anglais", "en").AddDescription("Chinois", "zh").Build(),
LanguageBuilder.Build("zh").AddDescription("<CHINESE>", "zh").AddDescription("<ENGLISH>", "en").AddDescription("<FRENCH>", "fr").Build()
Normally, the entire content of the website should be translated in the Global.resx. However, as explained in the previous conversation, there are translations present in the razor pages that need to be moved to the Global.resx file (please refer to ticket #693). We will address this issue in the upcoming release (4.0.8). Before proceeding, we need to complete the refactoring of the "Credential Issuer."
Languages are not fully translated due to missing translations. For each language, a translation must be provided.
For example :
LanguageBuilder.Build(Language.Default).AddDescription("English").AddDescription("French", "fr").AddDescription("Chinese", "zh").Build(), LanguageBuilder.Build("fr").AddDescription("Français", "fr").AddDescription("Anglais", "en").AddDescription("Chinois", "zh").Build(), LanguageBuilder.Build("zh").AddDescription("<CHINESE>", "zh").AddDescription("<ENGLISH>", "en").AddDescription("<FRENCH>", "fr").Build()
Normally, the entire content of the website should be translated in the Global.resx. However, as explained in the previous conversation, there are translations present in the razor pages that need to be moved to the Global.resx file (please refer to ticket #693). We will address this issue in the upcoming release (4.0.8). Before proceeding, we need to complete the refactoring of the "Credential Issuer."
I found a branch on your branch called "Ticket693_Move", I downloaded it and ran it, I found that when I changed the "Languages" in "IdServerConfiguration.cs" to what you said: 5002 page appears with two identical languages: I also tried to branch "Ticket693" and also modify "IdServerConfiguration.cs" and his display results are correct: In addition to the translation content of the two branches, is the code different?
Hello :)
The modifications made in the Ticket693_Move branch have been merged into the master branch. The translations of all Identity Server NuGet packages have been moved to the resources files, and I haven't made any other changes.
Even though the documentation has not been published yet, you can find some information here: https://github.com/simpleidserver/SimpleIdServer/blob/master/website/docs/developer/addlanguage.md
Hello :)
The modifications made in the Ticket693_Move branch have been merged into the master branch. The translations of all Identity Server NuGet packages have been moved to the resources files, and I haven't made any other changes.
Even though the documentation has not been published yet, you can find some information here: https://github.com/simpleidserver/SimpleIdServer/blob/master/website/docs/developer/addlanguage.md
Hello, thank you for your reply. 1、I found a problem with your tutorial, if written as you said: In the list of languages, there are two languages with the same meaning, but they are written differently for different languages: The correct thing to show in both languages is to write:
LanguageBuilder.Build(Language.Default).AddDescription("English", "en").AddDescription("Anglais", "fr").Build(), LanguageBuilder.Build("fr").AddDescription("Français", "fr").AddDescription("French", "en").Build()
The first line should be written in a different language's version of English, rather than in another language, as follows: 2、I retested the master version, but when I clicked on 'French', the page didn't translate and 'English' was selected back by default(Branch Ticket693 does not have this problem): https://github.com/simpleidserver/SimpleIdServer/assets/79817742/95b66f94-60e1-4df9-9cce-019a0e6e35b2 "SimpleIdServer. IdServer. I have been in the Website" projects has increased the following (just the file name is different, the content of did not change, I am a direct copy of a copy) :
3、Language not compatible with older versions: Using an older database does not add a new language to the database, you need to add it manually, or use a new database 4、Changing the contents of the 'Languages' in 'IdServerConfiguration.cs' also does not change the contents of the database, and can only be changed manually or regenerated automatically. It is recommended that you use a new database for testing, if you are unable to test for problems, it may be because your old database is correct.
I've made some changes in the master
branch.
The languages were not translated correctly, and there was a small issue in the documentation.
Now, when you start the SimpleIdServer project, the language will be automatically provisioned into the database, and there is no need to execute a custom SQL SCRIPT.
I've made some changes in the
master
branch. The languages were not translated correctly, and there was a small issue in the documentation. Now, when you start the SimpleIdServer project, the language will be automatically provisioned into the database, and there is no need to execute a custom SQL SCRIPT.
1、Thanks for your changes, the test found that the issue was resolved, but some translations were not included in the global variables: Authentication methods: Extract: 2、In "Clients", when the client "Name" has a value, the value will disappear after switching languages: https://github.com/simpleidserver/SimpleIdServer/assets/79817742/871e1a15-748b-4bec-ba9f-d29455bcca43 And the form does not display the name after adding the client:
It is normal that these translations are not present in the Global resource file because they are stored in the dbo.Translations
table.
You can execute the following SQL query to retrieve them:
SELECT [Record].[Name], [Translations].* FROM [IdServer].[dbo].[ConfigurationDefinitionRecord] [Record]
INNER JOIN [dbo].ConfigurationDefinitionRecordTranslation [Tr] ON [Tr].[ConfigurationDefinitionRecordId] = [Record].[Id]
INNER JOIN [dbo].[Translations] [Translations] ON [Translations].[Id] = [Tr].[TranslationsId]
It is normal that these translations are not present in the Global resource file because they are stored in the
dbo.Translations
table. You can execute the following SQL query to retrieve them:SELECT [Record].[Name], [Translations].* FROM [IdServer].[dbo].[ConfigurationDefinitionRecord] [Record] INNER JOIN [dbo].ConfigurationDefinitionRecordTranslation [Tr] ON [Tr].[ConfigurationDefinitionRecordId] = [Record].[Id] INNER JOIN [dbo].[Translations] [Translations] ON [Translations].[Id] = [Tr].[TranslationsId]
1、Ok, another problem is that the "client name" disappears after switching languages. Serial number 2 in here https://github.com/simpleidserver/SimpleIdServer/issues/670#issuecomment-1953365143 2、New problem: When adding "Children" after adding a group, delete the newly added "Children" immediately after adding the group successfully, resulting in deletion failure. 5002 reports an error: The video operation is as follows: https://github.com/simpleidserver/SimpleIdServer/assets/79817742/e878cb67-1ae1-476c-84c8-7eda656664f0
It is normal that these translations are not present in the Global resource file because they are stored in the
dbo.Translations
table. You can execute the following SQL query to retrieve them:SELECT [Record].[Name], [Translations].* FROM [IdServer].[dbo].[ConfigurationDefinitionRecord] [Record] INNER JOIN [dbo].ConfigurationDefinitionRecordTranslation [Tr] ON [Tr].[ConfigurationDefinitionRecordId] = [Record].[Id] INNER JOIN [dbo].[Translations] [Translations] ON [Translations].[Id] = [Tr].[TranslationsId]
does exist in the database, but the problem is that the database structure seems to be one-to-one to me: Because of compatibility with multiple languages, this relationship changes to one-to-many, and if I simply change the language of the "Translations" table to the language I need, it will only be compatible with the language I need, and the other languages will not be compatible.
Client name disappearance:
It is normal for the client name to disappear when the language is changed because this property is translatable. According to the RFC (https://openid.net/specs/openid-connect-registration-1_0.html#LanguagesAndScripts), the following client properties must be translatable:
You can update the client_name
in the Client Details screen.
Exception :
The exception "One or more errors occured" has been fixed in the master
branch. There was a small issue in the GroupReducer
class.
Database structure :
The database structure is MANY to MANY.
Client name disappearance:
It is normal for the client name to disappear when the language is changed because this property is translatable. According to the RFC (https://openid.net/specs/openid-connect-registration-1_0.html#LanguagesAndScripts), the following client properties must be translatable:
- client_name
- tos_uri
- policy_uri
- logo_uri
- client_uri
You can update the
client_name
in the Client Details screen.Exception : The exception "One or more errors occured" has been fixed in the
master
branch. There was a small issue in theGroupReducer
class.Database structure :
The database structure is MANY to MANY.
Client name disappearance: Yes, when I switched languages, after I updated "client_name" there were Translations for that language in the database table "Translations", of course for clients that were created before the translation work was done. I tested the creation of the client after switching languages, and I found that even though I changed languages, the language added to the "Translations" table for the name of the client was still en, not the language I switched, so do you need to change it here, instead of the default always being en, it is bound to the current language: The client is created assuming that the current Language is x, so when the client is created, the "language" column in the "Translations" table should be x, not en, which should fix the problem: If you make this change, the client name should not be blank after the creation here is successful. I have an idea. What do you think about this? When the client is created, all currently existing translation types are added to the "Translations" table at the same time (en, fr.....) As for the translated content, the value can be the same as the value of the client created in the current language, which can solve the problem of empty, at least will not let the user wonder that the value I created before disappeared (I think that the client name will not be deliberately translated), of course, if the user needs to change, then manually update can be. Database structure : Sorry to ignore this, originally "ConfigurationDefinitionRecordId" can be repeated, so that you can correspond to more than one language.
I noticed that the following figure does not change the translation after switching languages, but based on the first load, so I changed your code: The changes are as follows:
private static ProofOfPossession GetProofOfPossession() { return new ProofOfPossession { Name = "MTLS", Description = Global.Mtls }; } // Define a property to hold the ProofOfPossession private static ProofOfPossession MTLs => GetProofOfPossession();
The client name is incorrect.
The issue has been resolved in the master branch. When a client is added, its name will now be stored in the translation table with the correct language.
MTLS is not translated.
The issue has been addressed in the master branch; however, Mtls and Dpop are not defined as static variables.
As you expected, I printed 'Thread' on the published server CurrentThread Current Culture TwoLetterISOLanguageName 'found that the server output result is en, while the value in my Translations table is zh. However, not all of them are zh, and some are still en. This is why the pop-up content mentioned earlier is not affected. I think you can imitate the method where the field is still en and modify other methods to solve this problem
This is the database content on my publishing server: Starting from line 84, it will be automatically copied based on my system language. For example, when I publish the server, the value of en here is en, and my local value is zh, which is zh. Can you imitate the method here and modify other methods to ensure this effect and solve the problem I mentioned?
Another method is to modify the language of the publishing server to be the same as the database. I found that when I changed the server language to zh, after 84 lines in the database, the zh above 84 lines was still displayed as en, which caused the zh above 84 lines to be displayed normally, but the one below, which is en, to not be displayed. How did you assign values to the database and why is it different? (The databases used in this process are all from before and not from scratch), I tried to have the program recreate the library, I found that there seems to be no problem after recreating the library. Is there any problem with the process of assigning values to the database?Are there any values that are only assigned during table creation and not modified during subsequent operations.