[PR#886] fix(i18n): rename `pt-pt` to `pt` for European Portuguese (Portugal)

未分类 bolang 6个月前 (10-14) 59次浏览

Issue #886 | 状态: 已关闭 | 作者: cheton | 创建时间: 2024-10-17

标签: Enhancement documentation Review effort [1-5]: 2


PR Type

enhancement, documentation

_

Description

– Renamed the language code from pt-pt to pt for Portuguese (Portugal) across various configuration files.
– Added new translations for machine states, G-code commands, and resources in Portuguese (Portugal).
– Updated server settings to reflect the new language code and corrected a comment for the Ukrainian language.

_

Changes walkthrough 📝

Relevant files
Enhancement

build.config.js

Update language code for Portuguese (Portugal) in build configuration

build.config.js

  • Renamed language code from pt-pt to pt for Portuguese (Portugal).

  • +1/-1     
    i18n.js

    Modify i18n constants for Portuguese (Portugal)                   

    src/app/constants/i18n.js

  • Updated language code from pt-pt to pt for Portuguese (Portugal).

  • +1/-1     
    settings.base.js

    Adjust server settings for language codes                               

    src/server/config/settings.base.js

  • Changed language code from pt-pt to pt for Portuguese (Portugal).
  • Corrected comment for uk language to Ukrainian.

  • +4/-4     
    Documentation

    controller.json

    Add Portuguese translations for machine states                     

    src/app/i18n/pt/controller.json

    – Added translations for machine states in Portuguese (Portugal).

    +45/-1   
    gcode.json

    Add Portuguese translations for G-code commands                   

    src/app/i18n/pt/gcode.json

    – Added G-code command translations in Portuguese (Portugal).

    +42/-1   
    resource.json

    Add comprehensive Portuguese translations for resources   

    src/app/i18n/pt/resource.json

    – Added extensive resource translations in Portuguese (Portugal).

    +545/-1 
    config.json

    Configure text direction for Portuguese (Portugal)             

    src/server/i18n/pt/config.json

    – Added configuration for text direction in Portuguese (Portugal).

    +4/-1     
    resource.json

    Add server resource translations in Portuguese                     

    src/server/i18n/pt/resource.json

    – Added basic server resource translations in Portuguese (Portugal).

    +5/-1     

    _

    > 💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information


    评论 (6)

    #1 – codesandbox[bot] 于 2024-10-17

    #### Review or Edit in CodeSandbox

    Open the branch in source=ghapp”>VS Codesource=ghapp”>Preview


    #2 – codiumai-pr-agent-free[bot] 于 2024-10-17

    PR Reviewer Guide 🔍

    #### (Review updated until commit https://github.com/cncjs/cncjs/commit/9920ff52c86eec48b901e36ac6b2ec18958dc296)

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Language Code Change
    The language code for Portuguese (Portugal) has been changed from ‘pt-pt’ to ‘pt’. Verify that this change is consistent throughout the application and doesn’t break any existing functionality.

    JSON Indentation Change
    The JSON indentation has been changed from 4 spaces to 2 spaces. Ensure this change is intentional and consistent across all configuration files.

    Language List Modification
    The list of supported languages has been modified. Verify that all language codes are correct and that the changes don’t affect language selection functionality in the application.


    #3 – cheton 于 2024-10-17

    /improve


    #4 – codiumai-pr-agent-free[bot] 于 2024-10-17

    PR Code Suggestions ✨

    Latest suggestions up to 9920ff5

    Category Suggestion                                                                                                                                    Score
    Enhancement

    Add more detailed comments to clarify language code distinctions

    _

    Consider adding a comment to explain the difference between ‘pt’ and ‘pt-br’
    language codes, as it might not be immediately clear to all developers.

    [build.config.js [13-14]](https://github.com/cncjs/cncjs/pull/886/files#diff-ad214d6ab49228db3f19e72f9c741f7e6c63366a8f8000e1d83e2cb35f8d50c4R13-R14)

    -'pt', // European Portuguese (Portugal)
    -'pt-br', // Brazilian Portuguese (Brazil)
    +'pt', // European Portuguese (Portugal) - ISO 639-1 code
    +'pt-br', // Brazilian Portuguese (Brazil) - ISO 639-1 code with country extension
    

    – [ ] Apply this suggestion

    Suggestion importance[1-10]: 7

    Why:

    7

    Remove trailing whitespace to maintain consistency and prevent potential issues

    _

    Remove the trailing space in the translation for “Spindle On, CW (M3)”. This ensures
    consistency with other entries and prevents potential issues with string
    comparisons.

    [src/app/i18n/de/gcode.json [35]](https://github.com/cncjs/cncjs/pull/886/files#diff-f610a4f3f34151709dd9097ca47d234ecfa345d43f344688ca05ee9ddd656da1R35-R35)

    +"Spindle On, CW (M3)": "Spindel An, Rechtslauf (M3)",
     
    -
    

    – [ ] Apply this suggestion

    Suggestion importance[1-10]: 7

    Why:

    7

    Best practice

    Use a constant for configuration values to improve maintainability

    _

    Consider using a constant or configuration variable for the jsonIndent value to
    maintain consistency across different config files.

    [i18next-scanner.app.config.js [58]](https://github.com/cncjs/cncjs/pull/886/files#diff-fe6e0f9fde69f4220cfe10008bb7f2d898baa987fbe2d406c455ff34ddbf99efR58-R58)

    -jsonIndent: 2,
    +jsonIndent: CONFIG.JSON_INDENT,
    

    – [ ] Apply this suggestion

    Suggestion importance[1-10]: 7

    Why:

    7

    Maintain consistent JSON formatting for improved readability and maintainability

    _

    Consider using a consistent format for the JSON object. The new code uses a more
    compact format without indentation, while the old code used indentation. For
    consistency and readability, it’s recommended to use a consistent indentation style
    throughout the file.

    [src/app/i18n/de/gcode.json [1-41]](https://github.com/cncjs/cncjs/pull/886/files#diff-f610a4f3f34151709dd9097ca47d234ecfa345d43f344688ca05ee9ddd656da1R1-R41)

     {
    -  "Rapid Move (G0)": "Eilgang (G0)",
    -  "Linear Move (G1)": "Lineare Bewegung (G1)",
    -  ...
    -  "Coolant Off (M9)": "Kühlung Aus (M9)"
    +    "Rapid Move (G0)": "Eilgang (G0)",
    +    "Linear Move (G1)": "Lineare Bewegung (G1)",
    +    ...
    +    "Coolant Off (M9)": "Kühlung Aus (M9)"
     }
    
    Suggestion importance[1-10]: 7

    Why:

    7

    Maintainability

    Sort language codes alphabetically for improved organization

    _

    Consider sorting the language codes alphabetically for better readability and easier
    maintenance.

    [src/server/config/settings.base.js [126-133]](https://github.com/cncjs/cncjs/pull/886/files#diff-6dad1f27360ef711af55e29f0c87cfc81093abd0e22db10009e3c40c3af618adR126-R133)

    +'nl', // Dutch
    +'pt', // Portuguese (Portugal)
    +'pt-br', // Portuguese (Brazil)
    +'ru', // Russian
    +'tr', // Turkish
    +'uk', // Ukrainian
    +'zh-cn', // Simplified Chinese
    +'zh-tw', // Traditional Chinese
     
    -
    

    – [ ] Apply this suggestion

    Suggestion importance[1-10]: 7

    Why:

    7

    _

    #### Previous suggestions

    Suggestions up to commit 9920ff5

    Category Suggestion                                                                                                                                    Score
    Enhancement

    Add more detailed comments to clarify language code choices

    _

    Consider adding a comment to explain the difference between ‘pt’ and ‘pt-br’
    language codes, as it might not be immediately clear to all developers why both are
    necessary.

    [build.config.js [13-14]](https://github.com/cncjs/cncjs/pull/886/files#diff-ad214d6ab49228db3f19e72f9c741f7e6c63366a8f8000e1d83e2cb35f8d50c4R13-R14)

    -'pt', // European Portuguese (Portugal)
    -'pt-br', // Brazilian Portuguese (Brazil)
    +'pt', // European Portuguese (Portugal) - ISO 639-1 code
    +'pt-br', // Brazilian Portuguese (Brazil) - ISO 639-1 code with country extension
    

    Suggestion importance[1-10]: 7

    Why:

    7

    Improve German translations for better clarity and idiomatic language use

    _

    Consider using more idiomatic German translations for some of the machine states.
    For example, “Lauf” could be changed to “In Betrieb” for better clarity.

    [src/app/i18n/de/controller.json [9]](https://github.com/cncjs/cncjs/pull/886/files#diff-d953d170a5c657f42e68093e1d577983514f749431f0a586fd137a79a72732cbR9-R9)

    -"run": "Lauf",
    +"run": "In Betrieb",
    

    Suggestion importance[1-10]: 7

    Why:

    7

    Add missing translations for Smoothie controller states to ensure completeness

    _

    Consider adding translations for the missing states in the Smoothie section to
    maintain consistency with the other controller types.

    [src/app/i18n/de/controller.json [33-41]](https://github.com/cncjs/cncjs/pull/886/files#diff-d953d170a5c657f42e68093e1d577983514f749431f0a586fd137a79a72732cbR33-R41)

     "Smoothie": {
         "activeState": {
             "idle": "Leerlauf",
             "run": "Lauf",
             "hold": "Anhalten",
             "door": "Tür",
             "home": "Referenzfahrt",
    +        "sleep": "Schlafen",
             "alarm": "Alarm",
             "check": "Überprüfen"
         }
     }
    

    Suggestion importance[1-10]: 7

    Why:

    7

    Remove trailing whitespace in translation string

    _

    Remove the extra space at the end of the “Spindle On, CW (M3)” translation to
    maintain consistency with other entries.

    [src/app/i18n/de/gcode.json [35]](https://github.com/cncjs/cncjs/pull/886/files#diff-f610a4f3f34151709dd9097ca47d234ecfa345d43f344688ca05ee9ddd656da1R35-R35)

    +"Spindle On, CW (M3)": "Spindel An, Rechtslauf (M3)",
     
    -
    

    Suggestion importance[1-10]: 7

    Why:

    7

    Best practice

    Use a constant for configuration values to improve maintainability

    _

    Consider using a constant for the jsonIndent value to maintain consistency across
    configuration files.

    [i18next-scanner.app.config.js [58]](https://github.com/cncjs/cncjs/pull/886/files#diff-fe6e0f9fde69f4220cfe10008bb7f2d898baa987fbe2d406c455ff34ddbf99efR58-R58)

    -jsonIndent: 2,
    +jsonIndent: JSON_INDENT,
    

    Suggestion importance[1-10]: 7

    Why:

    7

    Maintainability

    Maintain consistent order of language codes across configuration files

    _

    Ensure that the order of language codes is consistent across all configuration files
    to avoid confusion and maintain uniformity.

    [src/server/config/settings.base.js [126-133]](https://github.com/cncjs/cncjs/pull/886/files#diff-6dad1f27360ef711af55e29f0c87cfc81093abd0e22db10009e3c40c3af618adR126-R133)

     'nl', // Dutch
     'pt', // Portuguese (Portugal)
     'pt-br', // Portuguese (Brazil)
     'ru', // Russian
     'tr', // Turkish
     'uk', // Ukrainian
     'zh-cn', // Simplified Chinese
    -'zh-tw', // Traditional Chinese
    +'zh-tw' // Traditional Chinese
    

    Suggestion importance[1-10]: 7

    Why:

    7

    Consistency

    Ensure consistency in translation format for coordinate system entries

    _

    Consider using a consistent format for the translation of “P1 (G54)” to “P6 (G59)”.
    Currently, these entries have translations while they were empty before. Ensure this
    change is intentional and consistent with other language files.

    [src/app/i18n/de/gcode.json [11-16]](https://github.com/cncjs/cncjs/pull/886/files#diff-f610a4f3f34151709dd9097ca47d234ecfa345d43f344688ca05ee9ddd656da1R11-R16)

    +"P1 (G54)": "P1 (G54)",
    +"P2 (G55)": "P2 (G55)",
    +"P3 (G56)": "P3 (G56)",
    +"P4 (G57)": "P4 (G57)",
    +"P5 (G58)": "P5 (G58)",
    +"P6 (G59)": "P6 (G59)",
     
    -
    

    Suggestion importance[1-10]: 7

    Why:

    7

    ✅ Suggestions up to commit 59dda69

    Category Suggestion                                                                                                                                    Score
    Enhancement

    ✅ Clarify language code comments to accurately represent supported Portuguese variants

    _

    Suggestion Impact:

    The commit updated the comments for the ‘pt’ and ‘pt-br’ language codes to clarify the Portuguese variants, aligning with the suggestion’s intent.

    code diff:

    -    'pt', // Portuguese (Portugal)
    -    'pt-br', // Portuguese (Brazil)
    +    'pt', // European Portuguese (Portugal)
    +    'pt-br', // Brazilian Portuguese (Brazil)
    

    _

    Consider updating the comment for the ‘pt’ language code to include both European
    and Brazilian Portuguese for clarity.

    [build.config.js [13-14]](https://github.com/cncjs/cncjs/pull/886/files#diff-ad214d6ab49228db3f19e72f9c741f7e6c63366a8f8000e1d83e2cb35f8d50c4R13-R14)

    -'pt', // Portuguese (Portugal)
    -'pt-br', // Portuguese (Brazil)
    +'pt', // Portuguese (European and Brazilian)
    +'pt-br', // Portuguese (Brazil, alternative code)
    

    Suggestion importance[1-10]: 7

    Why:

    7

    Use a more inclusive label for the Portuguese language option

    _

    Consider using a more generic label for the ‘pt’ language code to include both
    European and Brazilian Portuguese.

    [src/app/constants/i18n.js [11-12]](https://github.com/cncjs/cncjs/pull/886/files#diff-9286e66e8f57c2fa7079d1f78c4c15c55c54a5faf46ca568c3e735ff78a9bc8eR11-R12)

    -{ value: 'pt', label: 'Português (Portugal)' }, // European Portuguese
    -{ value: 'pt-br', label: 'Português (Brasil)' }, // Brazilian Portuguese
    +{ value: 'pt', label: 'Português' }, // Portuguese (covers both European and Brazilian)
    +{ value: 'pt-br', label: 'Português (Brasil)' }, // Brazilian Portuguese (alternative code)
    

    Suggestion importance[1-10]: 7

    Why:

    7

    ✅ Improve German translations for machine states to be more idiomatic and consistent with industry terminology

    _

    Suggestion Impact:

    The suggestion was implemented as the translations for “run” were changed to “Lauf” and “home” to “Referenzfahrt” in the commit.

    code diff:

    -            "run": "Lauf",
    -            "hold": "Anhalten",
    -            "probe": "Sondierung",
    -            "cycle": "Zyklus",
    -            "homing": "Referenzfahrt",
    -            "jog": "Joggen",
    -            "interlock": "Sicherheitsverriegelung",
    -            "shutdown": "Herunterfahren",
    -            "panic": "Panik"
    -        }
    -    },
    -    "Grbl": {
    -        "activeState": {
    -            "idle": "Leerlauf",
    -            "run": "Lauf",
    -            "hold": "Anhalten",
    -            "door": "Tür",
    -            "home": "Referenzfahrt",
    -            "sleep": "Schlafen",
    -            "alarm": "Alarm",
    -            "check": "Überprüfen"
    -        }
    -    },
    -    "Smoothie": {
    -        "activeState": {
    -            "idle": "Leerlauf",
    -            "run": "Lauf",
    -            "hold": "Anhalten",
    -            "door": "Tür",
    -            "home": "Referenzfahrt",
    -            "alarm": "Alarm",
    -            "check": "Überprüfen"
    -        }
    +  "TinyG": {
    +    "machineState": {
    +      "initializing": "Initialisierung",
    +      "ready": "Bereit",
    +      "alarm": "Alarm",
    +      "stop": "Programmstopp",
    +      "end": "Programmen Ende",
    +      "run": "Lauf",
    +      "hold": "Anhalten",
    +      "probe": "Sondierung",
    +      "cycle": "Zyklus",
    +      "homing": "Referenzfahrt",
    +      "jog": "Joggen",
    +      "interlock": "Sicherheitsverriegelung",
    +      "shutdown": "Herunterfahren",
    +      "panic": "Panik"
         }
    -}
    +  },
    +  "Grbl": {
    +    "activeState": {
    +      "idle": "Leerlauf",
    +      "run": "Lauf",
    +      "hold": "Anhalten",
    +      "door": "Tür",
    +      "home": "Referenzfahrt",
    +      "sleep": "Schlafen",
    +      "alarm": "Alarm",
    +      "check": "Überprüfen"
    +    }
    +  },
    +  "Smoothie": {
    +    "activeState": {
    +      "idle": "Leerlauf",
    +      "run": "Lauf",
    +      "hold": "Anhalten",
    +      "door": "Tür",
    +      "home": "Referenzfahrt",
    

    _

    Consider using more idiomatic German translations for some of the machine states.
    For example, “Ausführen” could be changed to “Lauf” for “run”, and “Startposition”
    to “Referenzfahrt” for “home”.

    [src/app/i18n/de/controller.json [23-26]](https://github.com/cncjs/cncjs/pull/886/files#diff-d953d170a5c657f42e68093e1d577983514f749431f0a586fd137a79a72732cbR23-R26)

    -"run": "Ausführen",
    -"hold": "Halten",
    -"door": "Tür",
    -"home": "Startposition",
    +"run": "Lauf",
    +"hold": "Halt",
    +"door": "Tür offen",
    +"home": "Referenzfahrt",
    

    Suggestion importance[1-10]: 7

    Why:

    7

    Remove trailing whitespace in translation strings for consistency

    _

    Remove the trailing space in the translation for “Spindle On, CW (M3)” to maintain
    consistency with other entries.

    [src/app/i18n/de/gcode.json [35]](https://github.com/cncjs/cncjs/pull/886/files#diff-f610a4f3f34151709dd9097ca47d234ecfa345d43f344688ca05ee9ddd656da1R35-R35)

    +"Spindle On, CW (M3)": "Spindel An, Rechtslauf (M3)",
     
    -
    

    Suggestion importance[1-10]: 7

    Why:

    7

    ✅ Suggestions up to commit 938a32b

    Category Suggestion                                                                                                                                    Score
    Enhancement

    ✅ Correct spelling in translation file to improve accuracy

    _

    Consider using “Suspensão” instead of “Suspenção” for the “sleep” state in the Grbl
    section to correct the spelling.

    [src/app/i18n/pt/controller.json [27]](https://github.com/cncjs/cncjs/pull/886/files#diff-48f2e75fe9ab271bd8923c0652f6cab6bc08f82c9dafd133ab6ecb620ba74370R27-R27)

    -"sleep": "Suspenção",
    +"sleep": "Suspensão",
    

    [Suggestion has been applied]

    Suggestion importance[1-10]: 9

    Why: Correcting the spelling from “Suspenção” to “Suspensão” improves the accuracy of the translation, which is crucial for maintaining professionalism and clarity in the translation file.

    9

    Maintain alphabetical order in the language list for better organization and readability

    _

    Consider updating the order of language entries to maintain alphabetical sorting.
    Move the new ‘pt’ entry before ‘pt-br’ to keep the list organized.

    [src/app/constants/i18n.js [10-12]](https://github.com/cncjs/cncjs/pull/886/files#diff-9286e66e8f57c2fa7079d1f78c4c15c55c54a5faf46ca568c3e735ff78a9bc8eR10-R12)

    +{ value: 'nl', label: 'Nederlands' },
    +{ value: 'pt', label: 'Português (Portugal)' },
    +{ value: 'pt-br', label: 'Português (Brasil)' },
     
    -
    

    Suggestion importance[1-10]: 8

    Why: The suggestion to maintain alphabetical order in the language list improves organization and readability, making it easier for developers to locate specific entries.

    8

    ✅ Translate missing entries in the G-code translation file to ensure completeness

    _

    Consider translating the empty strings for “Active Tool Offset (G43.1)” and “No Tool
    Offset (G49)” to maintain consistency in the translation file.

    [src/app/i18n/pt/gcode.json [29-30]](https://github.com/cncjs/cncjs/pull/886/files#diff-67ad25f5467161a53eaf26246ce2cb4ad2a8807d3b23746ebe60e1d844ec1b13R29-R30)

    -"Active Tool Offset (G43.1)": "",
    -"No Tool Offset (G49)": "",
    +"Active Tool Offset (G43.1)": "Compensação de Ferramenta Ativa (G43.1)",
    +"No Tool Offset (G49)": "Sem Compensação de Ferramenta (G49)",
    

    [Suggestion has been applied]

    Suggestion importance[1-10]: 8

    Why: The suggestion addresses missing translations for “Active Tool Offset (G43.1)” and “No Tool Offset (G49)”, enhancing the completeness and consistency of the translation file.

    8

    ✅ Translate missing M-code command to ensure completeness of the G-code translation file

    _

    Translate “Optional Program Stop (M1)” to maintain consistency with other translated
    M-code commands.

    [src/app/i18n/pt/gcode.json [32]](https://github.com/cncjs/cncjs/pull/886/files#diff-67ad25f5467161a53eaf26246ce2cb4ad2a8807d3b23746ebe60e1d844ec1b13R32-R32)

    -"Optional Program Stop (M1)": "",
    +"Optional Program Stop (M1)": "Paragem Opcional do Programa (M1)",
    

    [Suggestion has been applied]

    Suggestion importance[1-10]: 8

    Why: Translating “Optional Program Stop (M1)” fills a gap in the translation file, ensuring consistency with other translated M-code commands and improving the file’s completeness.

    8

    ✅ Standardize translations across different controller types for consistency

    _

    For consistency, consider using “Suspensão” instead of “Dormir” for the “sleep”
    state in the Smoothie section, matching the translation used in the Grbl section.

    [src/app/i18n/pt/controller.json [39]](https://github.com/cncjs/cncjs/pull/886/files#diff-48f2e75fe9ab271bd8923c0652f6cab6bc08f82c9dafd133ab6ecb620ba74370R39-R39)

    -"sleep": "Dormir",
    +"sleep": "Suspensão",
    

    [Suggestion has been applied]

    Suggestion importance[1-10]: 7

    Why: Changing “Dormir” to “Suspensão” for the “sleep” state in the Smoothie section ensures consistency with the Grbl section, enhancing uniformity across different controller types.

    7

    Best practice

    Maintain consistent comment formatting throughout the language list

    _

    Ensure consistency in comment formatting by adding a period at the end of the
    ‘Dutch’ comment, similar to other language comments.

    [src/server/config/settings.base.js [126-128]](https://github.com/cncjs/cncjs/pull/886/files#diff-6dad1f27360ef711af55e29f0c87cfc81093abd0e22db10009e3c40c3af618adR126-R128)

    -'nl', // Dutch
    +'nl', // Dutch.
     'pt', // Portuguese (Portugal)
     'pt-br', // Portuguese (Brazil)
    

    Suggestion importance[1-10]: 5

    Why: While the suggestion to add a period for consistency in comment formatting is valid, it is a minor stylistic improvement with limited impact on the code’s functionality or readability.

    5


    #5 – cheton 于 2024-10-17

    /review


    #6 – codiumai-pr-agent-free[bot] 于 2024-10-17

    Persistent review updated to latest commit https://github.com/cncjs/cncjs/commit/9920ff52c86eec48b901e36ac6b2ec18958dc296


    原始Issue: https://github.com/cncjs/cncjs/pull/886

    喜欢 (0)